题意:统计在n,m之间的数的二进制表示形式只有一个零的数目。

位运算模拟+dfs

 #include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<stack>
#include<cmath>
#include<queue>
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define ll long long
#define clc(a,b) memset(a,b,sizeof(a))
const int maxn=; ll n,m;
ll ans;
void dfs(ll a,ll b)
{
if(a>m)
return ;
if(a>=n&&a<=m&&b==)
ans++;
if(b==)
dfs(a*,);
dfs(a*+,b);
} int main()
{
while(~scanf("%I64d%I64d",&n,&m))
{
ans=;
dfs(,);
printf("%I64d\n",ans);
}
return ;
}

最新文章

  1. 使用Android Butterknife
  2. (转)json+flexgrid+jbox组合运用页面刷新&lt;jsp&gt;
  3. hive,spark的远程调试设置
  4. 自己写http获取网络资源和解析json数据
  5. 解决lucene 重复索引的问题
  6. C#学习笔记二:C#程序结构
  7. 移动端web解决方案
  8. 【bird-front】全自动数据表格组件bird-grid
  9. 通过Navicat连接MySQL数据库
  10. 主席树[可持久化线段树](hdu 2665 Kth number、SP 10628 Count on a tree、ZOJ 2112 Dynamic Rankings、codeforces 813E Army Creation、codeforces960F:Pathwalks )
  11. mongodb参数
  12. MapReduce实现ReduceSideJoin操作
  13. Laravel Eloquent ORM 时如何查询表中指定的字段
  14. [archlinux] linux boot process/order/stage
  15. Android笔记:OptionsMenu
  16. sql 获取批处理信息的脚本(优化器在处理批处理时所发生的优化器事件)
  17. python + pyqt5 QlineEdit QMessageBox实现信息录入和消息弹框提醒
  18. Wannafly挑战赛21A
  19. java转义符和正则表达式转义符
  20. Android之四大组件、六大布局、五大存储 总结

热门文章

  1. 结构体 typedef关键字
  2. 10个CSS简写/优化技巧
  3. spoj 338
  4. &lt;Learning How to Learn&gt;Week One: Focused versus Diffuse Thinking
  5. OneAPM x 腾讯 | OneAPM 技术公开课&#183;深圳 报名:前端性能大作战!
  6. Flask, Tornado, GEvent, 以及它们的结合的性能比较
  7. 关于jsp页面是放在webroot目录下和web-inf下优缺点
  8. hhtml from表单为什么能提交数据
  9. Web开发的绝美网站
  10. node.js模块之util模块