CodeForces 611BNew Year and Old Property
来源:互联网 发布:qq管家抢软件 编辑:程序博客网 时间:2024/06/06 00:41
题意:
找出a->b有几个值的二进制只有一个0
思路:
这种二进制自己还真是想不清楚,对于数字枚举二进制是0的位置,带进去看是多少返回就行
#include<cstdio>#include<cstring>#include<iostream>#include<queue>using namespace std;#define MAXD 1000 + 100#define Inf 1 << 30long long s[100];long long a,b;long long solve(int n){ long long sum=0; for(int i=1;i<=n;i++) { sum+=s[i]<<(i-1); } return sum;}int main(){ cin>>a>>b; for(int i=1;i<=64;i++) s[i]=1; int ans=0; for(int i=2;i<=64;i++) { for(int j=1;j<i;j++) { s[j]=0; if(solve(i)>=a&&solve(i)<=b) { ans++; } s[j]=1; } } cout<<ans<<endl;}
0 0
- CodeForces 611BNew Year and Old Property
- CodeForces 611BNew Year and Old Property(模拟)
- CodeForces 611 B. New Year and Old Property(水~)
- codeforces-611B-New Year and Old Property
- CodeForces 611B New Year and Old Property(DFS)
- CodeForces 611B - New Year and Old Property(搜索)
- 【Goodbye2015】Codeforces 611B New Year and Old Property【思维】
- codeforces 611B New Year and Old Property
- New Year and Old Property CodeForces
- New Year and Old Property CodeForces
- codeforces - Goodbye2015B - New Year and Old Property(模拟)
- CodeForces 611B New Year and Old Property【DFS&&模拟位运算】
- 611B. New Year and Old Property【模拟位运算】
- B. New Year and Old Property
- codeforces611B. New Year and Old Property
- Codeforces Good Bye 2015 B. New Year and Old Property (DFS)
- Codeforences Goodbye 2015 B New Year and Old Property
- cf#gb2015-B - New Year and Old Property-暴力
- va_list深究
- hbase 客户端超时、重连设置
- [编程题]求int型正整数在内存中存储时1的个数
- 20161209计算机科学导论04_试卷
- 图片上传至数据库(新浪云)的方法
- CodeForces 611BNew Year and Old Property
- Session技术
- mysql 日期和时间格式转换实现语句
- iOS UIimageView 实现动态图播放
- 机器学习基础知识(一)
- Linux lsof命令:查看进程打开哪些文件、查看文件被哪些进程打开
- 字符设备驱动第十八课---platform2
- Concurrency Program(并发编程)
- iOS中的HotFix方案总结详解