题意:一数列an,如果存在一个k,有2^(ai)+2^(aj)+......=2^k成立,那么一次能拿走ai,aj这些全部。问最少拿的次数。

太简单。

乱码

//#pragma comment(linker,"/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include <stack>
#include <ctime>
#include <iomanip>
using namespace std;
const int SZ=,INF=0x7FFFFFFF;
typedef long long lon;
lon num[SZ]; int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
int n;
//for(;cin>>n,n;)
{
cin>>n;
for(int i=;i<n;++i)
{
int tmp;
cin>>tmp;
++num[tmp];
}
for(int i=;i<SZ;++i)
{
num[i+]+=num[i]/;
num[i]=(num[i]&);
}
// for(int i=0;i<SZ;++i)
// {
// if(num[i])cout<<i<<" ";
// }cout<<endl;
int res=count(num,num+SZ,);
cout<<res<<endl;
}
return ;
}

codeforces587a//Duff and Weight Lifting// Codeforces Round #326 (Div. 1)的更多相关文章

  1. Codeforces Round #326 (Div. 2) C. Duff and Weight Lifting 水题

    C. Duff and Weight Lifting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...

  2. Codeforces Round #326 (Div. 2) B. Pasha and Phone C. Duff and Weight Lifting

    B. Pasha and PhonePasha has recently bought a new phone jPager and started adding his friends' phone ...

  3. Codeforces Round #326 (Div. 2) D. Duff in Beach dp

    D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/probl ...

  4. Codeforces Round #326 (Div. 2) B. Duff in Love 分解质因数

    B. Duff in Love Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/proble ...

  5. Codeforces Round #326 (Div. 2) A. Duff and Meat 水题

    A. Duff and Meat Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/probl ...

  6. Codeforces Round #326 (Div. 2)-Duff and Meat

    题意: Duff每天要吃ai千克肉,这天肉的价格为pi(这天可以买好多好多肉),现在给你一个数值n为Duff吃肉的天数,求出用最少的钱满足Duff的条件. 思路: 只要判断相邻两天中,今天的总花费 = ...

  7. 「日常训练」Duff in the Army (Codeforces Round #326 Div.2 E)

    题意(CodeForces 588E) 给定一棵\(n\)个点的树,给定\(m\)个人(\(m\le n\))在哪个点上的信息,每个点可以有任意个人:然后给\(q\)个询问,每次问\(u\)到\(v\ ...

  8. Codeforces Round #326 (Div. 2) B Duff in Love 简单数论 姿势涨

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  9. Codeforces Round #326 (Div. 2)-Duff in Love

    题意: 一个数x被定义为lovely number需要满足这样的条件:不存在一个数a(a>1),使得a的完全平方是x的因子(即x % a2  != 0). 给你一个数n,求出n的因子中为love ...

随机推荐

  1. Linux内核中的wake_lock[【转】

    本文转载自:https://blog.csdn.net/wuyb2011/article/details/78542233?locationNum=11&fps=1 #include < ...

  2. Java 使用命令对堆线程分析

    一.dump基本概念 在故障定位(尤其是out of memory)和性能分析的时候,经常会用到一些文件来帮助我们排除代码问题.这些文件记录了JVM运行期间的内存占用.线程执行等情况,这就是我们常说的 ...

  3. Calculate difference between consecutive data points in a column from a file

    cat > temp0015101269125  awk 'p{print $0-p}{p=$0}' temp00152-633-7 REF: https://www.unix.com/shel ...

  4. Ubuntu 18.04版本下安装网易云音乐

    这是我迄今为止发现的最完美的解决方法,不用改任何东西,只需要安装然后打开即可,后台也有. 参考:http://archive.ubuntukylin.com:10006/ubuntukylin/poo ...

  5. 3、Python编程之MySQLdb模块(0602)

    解释器环境与选项 python解释器启动 python [options] [ -c cmd | filename | - ] [ args ] python解释器环境变量 python代码的测试.调 ...

  6. Lintcode521-Remove Duplicate Numbers in Array-Easy

    Description Given an array of integers, remove the duplicate numbers in it. You should: Do it in pla ...

  7. Gym 101617J Treasure Map(bfs暴力)

    http://codeforces.com/gym/101617/attachments 题意:给出一个图,每个顶点代表一个金矿,每个金矿有g和d两个值,g代表金矿初始的金子量,d是该金矿每天的金子量 ...

  8. Youtube-dl 配置 使用方法 + 配合aria2 多线程 下载 + 配合 ffmpeg 自动合并分段视频

    首先介绍软件,Youtube-dl可以下载网页的视频,功能很强大. 但遇到分段视频不能合并,遇到视频音频分开播放的网站也没办法合并视频音频,所以 需要用ffmpeg来配合的合并视频.合并过程是无损的, ...

  9. python 比较两个yaml文件

    import yaml with open("a.yaml") as f: with open("a.yaml") as k: ): x=f.readline( ...

  10. 【汇总】基于.NET平台常用的框架整理

    分布式缓存框架: Microsoft Velocity:微软自家分布式缓存服务框架. Memcahed:一套分布式的高速缓存系统,目前被许多网站使用以提升网站的访问速度. Redis:是一个高性能的K ...