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 ...
随机推荐
- IE浏览器版本判断
<script type="text/javascript"> var browser=navigator.appName var b_version=navigato ...
- 虚拟机安装Ubuntu三种网络模式
VMWare提供三种工作模式桥接(bridge).NAT(网络地址转换)和host-only(主机模式). NAT(网络地址转换) 在NAT模式下,虚拟系统需要借助NAT(网络地址转换)功能,通过宿主 ...
- Javascript高级程序设计——函数
函数Function 通过函数封装多条语句,在任何地方执行.javascript函数不会重载,相同名字函数,名字属于后定义的函数通过function关键词声明. function functionNa ...
- mongodb certification
又偷懒 也有学到不少东西 这个东西算是小结啦 给2013年的碌碌无为挽回点面子 哈哈~
- Eclipse高级使用技巧
1. Eclipse的配置文件导入和导出功能 说明:可以将Eclipse的自定义的工作空间配置文件导出和导入,这样创建多工作空间时候就省去了再设置的烦恼. 2. Eclipse设置显示行号 说明:设置 ...
- iOS开发——网络篇——JSON和XML,NSJSONSerialization ,NSXMLParser(XML解析器),NSXMLParserDelegate,MJExtension (字典转模型),GDataXML(三方框架解析XML)
一.JSON 1.JSON简介什么是JSONJSON是一种轻量级的数据格式,一般用于数据交互服务器返回给客户端的数据,一般都是JSON格式或者XML格式(文件下载除外) JSON的格式很像OC中的字典 ...
- dispaly:table-cell,inline-block,阐述以及案例
display:table 此元素会作为块级表格来显示(类似 <table>),表格前后带有换行符.dispaly:table-row 此元素会作为一个表格行显示(类似 <tr> ...
- (备忘)android模拟器摄像头模拟
Camera分Front Camera和Back Camera 通常我们模拟后摄像头就可以了 三个选项 none:表示没有摄像头,打开摄像应用会崩溃 emulated:系统模拟一个动态的画面--在黑白 ...
- Android九点图(Nine-Patch)制作及应用
你可能之前还没有听说过Nine-Patch这个名词,它是一种被特殊处理过PNG图片,能够指定哪些区域可以被拉伸而哪些区域不可以. 现在我将手把手教你如何去制作一张九点PNG图像. ---------- ...
- java文件压缩和解压
功能实现. package com.test; import java.io.File; import java.io.BufferedOutputStream; import java.io.Buf ...