题目链接: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循环)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 二分 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) D

    http://codeforces.com/contest/722/problem/D 题目大意:给你一个没有重复元素的Y集合,再给你一个没有重复元素X集合,X集合有如下操作 ①挑选某个元素*2 ②某 ...

  5. 线段树 或者 并查集 Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C

    http://codeforces.com/contest/722/problem/C 题目大意:给你一个串,每次删除串中的一个pos,问剩下的串中,连续的最大和是多少. 思路一:正方向考虑问题,那么 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 用hexo书写github.io博客 学习心得 教程

    很久没更新文章了,除了工作忙之外,可能就是自己懒惰了. 最近混迹与github,发现git上写博客也是个很不错的平台. 推荐使用 hexo 模版来书写,毕竟我们重点是写文章,而不是管理,所以有神奇何妨 ...

  2. IE6对png图片的处理

    在学习phpcms系统搜索模块的时候,发现下面这段代码: <!--[if IE 6]> <script type="text/javascript" src=&q ...

  3. ACdream1063——平衡树

    1.题目大意:让你设计一种数据结构,支持插入一个数,和在这个结构里查询结构中的哪个数和给定的数的异或值最小 2.分析:这个怎么做呢,就是trie树,我们建立一个trie树,把树按01进制存进去,然后在 ...

  4. jquery版瀑布流

    一个月前用jquery实现了瀑布流效果,看着当时的代码有点难过……今天抽时间稍微修改了一下.额,现在看起来不是那么难受了,就来和大家分享一下.废话不多说,开始正题~ 一.演示效果 二.html代码 & ...

  5. Genymotion自动化启动

      一.启动方式 命令行: player.exe --vm-name [模拟器名称]   例子: "D:\Program files\Genymobile\Genymotion\player ...

  6. docker ui

    docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-doc ...

  7. 【GoLang】GoLang 中 make 与 new的区别

    make.new操作 make用于内建类型(map.slice 和channel)的内存分配.new用于各种类型的内存分配. 内建函数new本质上说跟其它语言中的同名函数功能一样:new(T)分配了零 ...

  8. Word Search I & II

    Word Search I Given a 2D board and a word, find if the word exists in the grid. The word can be cons ...

  9. LINQ查询数组里面是否包含某值

    #region linq to 数组            //定义数组,并初始化            string [] array = new string []{"Juan" ...

  10. wxpython 基本的控件 (文本)

    wxPython 工具包提供了多种不同的窗口部件,包括了本章所提到的基本控件.我们涉及静态文本.可编辑的文本.按钮.微调.滑块.复选框.单选按钮.选择器.列表框.组合框和标尺.对于每种窗口部件,我们将 ...