Codeforences Goodbye 2015 B New Year and Old Property
2016-01-12 22:14
369 查看
题目传送门
题意:算出 a,b 中 二进制下,含有 且 只含有1个0的数 的数目 解题方法:暴力(dfs) #include<bits/stdc++.h> using namespace std; #define ll long long ll n,m; ll ans; void dfs(ll x,ll cnt) { if(x>m)return ; if(x>=n&&x<=m&&cnt==1) ans++; if(cnt==0) dfs(2*x,1); dfs(2*x+1,cnt); } int main() { cin>>n>>m; ans=0; dfs(1,0); cout<<ans<<endl; return 0; }
相关文章推荐
- OpenGL介绍
- Linux之DebugFS(一)-----------------------追踪内核函数调用
- Linux下Tomcat的安装
- Tengine笔记3:Nginx的反向代理和健康状态检查
- Linux系统精讲(2.6-3.9)
- 为Mac自带的Apache配置PHP和虚拟机
- hadoop基础:第二部分 关于MapReduce
- Linux内核构建系统之八
- Linux中各种终端的解释
- Hadoop伪分布式搭建
- Linux TOP 命令详述
- Linux下各规格的磁盘操作
- Bash定制化之ACCSI字符图
- PopupWindow
- linux链接--硬链接,软链接
- Linux进程间通信之管道
- Could not open ServletContext resource报错解决方法
- Linux下设置环境变量
- 综合一句话Shell破解
- shell example01