题目链接: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. 查询oracle数据库中的所有表空间信息

    "空闲比例" totalspace,sum(t.blocks) totalblocks from dba_data_files t group by t.tablespace_na ...

  2. dispaly:table-cell,inline-block,阐述以及案例

    display:table 此元素会作为块级表格来显示(类似 <table>),表格前后带有换行符.dispaly:table-row 此元素会作为一个表格行显示(类似 <tr> ...

  3. [BZOJ2656][codevs1207][Zjoi2012]数列(sequence)

    [BZOJ2656][codevs1207][Zjoi2012]数列(sequence) 试题描述 小白和小蓝在一起上数学课,下课后老师留了一道作业,求下面这个数列的通项公式: 小白作为一个数学爱好者 ...

  4. java的ArrayList使用方法

    在第N个数据后面添加一个数据 用法: 在第1个元素后面添加E list.add(1, "E");

  5. 【云计算】docker三剑客如何支持分布式部署?

    This blog will explain how to create multi-container application deployed on multiple hosts using Do ...

  6. Binary Tree Upside Down

    Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that ...

  7. Walls and Gates

    You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstac ...

  8. 7.31 签到,js 全局预处理笔记

    js 解析与执行过程: 一.全局:  1.预处理阶段 : 1.LexicalEnviroment === window {1.预处理 var   |   2.function xxx //预处理申明的 ...

  9. winserver2008 Oracle 11g 安装

    .在Windows Server2008R2上安装Oracle Database 11g Release 2,下载64位的安装程序,地址: 文件1:http://download.oracle.com ...

  10. wxPython:事件

    事件──── 是每个 GUI 应用不可舍割的一部分,因为所有的 GUI 应用程序都是基于事件驱动的.从 GUI 程序启动开始,它就回应同户的不同类型的事件.除了用户,也有其它因素可以产生事件,例如:互 ...