Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)(set容器里count函数以及加强for循环)
题目链接:http://codeforces.com/contest/722/problem/D 1 #include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <set>
#include <map>
#define mod 1000000007
#define MAXN 100+10
#define INF 1000000000
#define eps 10e-6
#define ll long long
using namespace std; bool cmp(int a, int b)
{
return a > b;
} //****************************************************************************** int main(void)
{
//std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int n;
set<int>st;
cin >> n;
for(int i=; i<n; i++)
{
int x;
cin >> x;
st.insert(x);
}
while()
{
int x=*st.rbegin(), i;
for(i=x; i&&st.count(i); i/=); //***st.count(x)查找st里i出现的次数
if(!i)
{
break;
}
st.erase(x);
st.insert(i);
}
for(int it : st) //***类似java里面的加强for循环
{
printf("%d ", it);
}
printf("\n");
return ;
}
Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)(set容器里count函数以及加强for循环)的更多相关文章
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) A B C D 水 模拟 并查集 优先队列
A. Broken Clock time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) B. Verse Pattern 水题
B. Verse Pattern 题目连接: http://codeforces.com/contest/722/problem/B Description You are given a text ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined)
A. Broken Clock time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- 二分 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D
http://codeforces.com/contest/722/problem/D 题目大意:给你一个没有重复元素的Y集合,再给你一个没有重复元素X集合,X集合有如下操作 ①挑选某个元素*2 ②某 ...
- 线段树 或者 并查集 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C
http://codeforces.com/contest/722/problem/C 题目大意:给你一个串,每次删除串中的一个pos,问剩下的串中,连续的最大和是多少. 思路一:正方向考虑问题,那么 ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D. Generating Sets 贪心
D. Generating Sets 题目连接: http://codeforces.com/contest/722/problem/D Description You are given a set ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array 带权并查集
C. Destroying Array 题目连接: http://codeforces.com/contest/722/problem/C Description You are given an a ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) A. Broken Clock 水题
A. Broken Clock 题目连接: http://codeforces.com/contest/722/problem/A Description You are given a broken ...
- Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array
C. Destroying Array time limit per test 1 second memory limit per test 256 megabytes input standard ...
随机推荐
- COM中的REFIID小解【转】
是在浏览器项目中的IDispatch调用QueryInterface( [in] REFIID riid, [out] void **ppvObject); 认识的REFIID,由于看声明说r ...
- sass跨文件重写变量
利用变量默认值: !default 你可以在变量尚未赋值前,通过在值的末尾处添加 !default 标记来为其指定. 也就是说,如果该变量已经被赋值, 就不会再次赋值, 但是,如果还没有被赋值,就会被 ...
- mongodb的sql例子(简单版)
插入数据 db.person.insert({"name":"zfx","age":21}) 查找所有数据 db.person.find() ...
- hdu4747——Mex
1.题目大意:对一个序列的每一个区间求Mex,最后所有的mex相加(mex就是SG的那个),力求nlogn... 2.分析:最近开始刷线段树了,还是有很多不会啊 首先把1-1 1-2 1-- 1-n这 ...
- Unity3D性能优化--- 收集整理的一堆
http://www.cnblogs.com/willbin/p/3389837.html 官方优化文档--优化图像性能http://docs.unity3d.com/Documentation/Ma ...
- python\c交互学习网站手机
http://use-python.readthedocs.org/zh_CN/latest/interact_with_other_language.html https://www.zhihu.c ...
- Kali Linux渗透基础知识整理(三):漏洞利用
漏洞利用阶段利用已获得的信息和各种攻击手段实施渗透.网络应用程序漏洞诊断项目的加密通信漏洞诊断是必须执行的.顾名思义,利用漏洞,达到攻击的目的. Metasploit Framework rdeskt ...
- MikroTik RouterOS防火墙与过滤详解
MikroTik RouterOS能对包状态过滤:P2P协议过滤:源和目标NAT:对源MAC.IP地址.端口.IP协议.协议(ICMP.TCP.MSS等).接口.对内部的数据包和连接作标记.ToS 字 ...
- minigui移植到arm linux开发板上无法执行
要保证目录下有该文件 /etc/MiniGUI.cfg 复制过程使用cp –af 强制复制
- vtigerCRM5.4的安装和汉化 ubuntu
由于php5.5经过较大改变,安装vtigercrm的时候可能需要修改一些配置 1.去官网下载vtiger5.4压缩包,解压后放在/var/www目录下 2.简单起见,将目录权限设置为777 vtig ...