题意:一数列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. C/C++宏定义交换两个值

    #define SWAP(t,a,b) \ do{ \ t c = a; \ a = b; \ b = c; \ }); void main() { ,b=; SWAP(int,a,b); }

  2. Provinces of China

    https://en.wikipedia.org/wiki/Provinces_of_China#Province

  3. upc组队赛1 黑暗意志【stl-map】

    黑暗意志 题目描述 在数千年前潘达利亚从卡利姆多分离之时,迷雾笼罩着这块新形成的大陆,使它不被外来者发现.迷雾同样遮蔽着这片大陆古老邪恶的要塞--雷神的雷电王座.在雷神统治时期,他的要塞就是雷电之王力 ...

  4. tp框架中的一些疑点知识-6

    vim自带一个目录浏览器,使用命令:E就可以调出来,实际上就是浏览器的名字就是"网络读写"netrw vim也自带了 补全功能, 启动键是 "ctrl_N" 或 ...

  5. Dubbo集群配置和官方文档

    集群配置: https://blog.csdn.net/zh520qx/article/details/63679908 https://www.cnblogs.com/hd3013779515/p/ ...

  6. 【20K必备知识点】北上广Java开发月薪20K往上,该如何做,需要会写什么

    有人回答说这只能是大企业或者互联网企业工程师才能拿到.也许是的,小公司或者非互联网企业拿两万的不太可能是码农了,应该已经转管理.还有区域问题,这个不在我的考虑范围内,因为除了北上广深杭,其他地方也很难 ...

  7. 深度学习课程笔记(十三)深度强化学习 --- 策略梯度方法(Policy Gradient Methods)

    深度学习课程笔记(十三)深度强化学习 --- 策略梯度方法(Policy Gradient Methods) 2018-07-17 16:50:12 Reference:https://www.you ...

  8. 《剑指Offer 1.二维数组中的查找》2019-03-25

    剑指Offer  第一题 题目描述 在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数 ...

  9. 几个C++ online test 网站

    http://www.mycppquiz.com/list.php http://www.codelect.net/TestDetails/Cplusplus-Senior-Level-Test ht ...

  10. mybatis结合mysql批量操作及查询sql

    MySQL数据库 批量操作主要使用的是Mybatis的foreach,遍历参数列表执行相应的操作,所以批量插入/更新/删除的写法是类似的,只是SQL略有区别而已.MySql批量操作需要数据库连接配置a ...