good bye 2015 B - New Year and Old Property
2024-10-15 00:16:03
题意:统计在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 ;
}
最新文章
- 使用Android Butterknife
- (转)json+flexgrid+jbox组合运用页面刷新<;jsp>;
- hive,spark的远程调试设置
- 自己写http获取网络资源和解析json数据
- 解决lucene 重复索引的问题
- C#学习笔记二:C#程序结构
- 移动端web解决方案
- 【bird-front】全自动数据表格组件bird-grid
- 通过Navicat连接MySQL数据库
- 主席树[可持久化线段树](hdu 2665 Kth number、SP 10628 Count on a tree、ZOJ 2112 Dynamic Rankings、codeforces 813E Army Creation、codeforces960F:Pathwalks )
- mongodb参数
- MapReduce实现ReduceSideJoin操作
- Laravel Eloquent ORM 时如何查询表中指定的字段
- [archlinux] linux boot process/order/stage
- Android笔记:OptionsMenu
- sql 获取批处理信息的脚本(优化器在处理批处理时所发生的优化器事件)
- python + pyqt5 QlineEdit QMessageBox实现信息录入和消息弹框提醒
- Wannafly挑战赛21A
- java转义符和正则表达式转义符
- Android之四大组件、六大布局、五大存储 总结
热门文章
- 结构体 typedef关键字
- 10个CSS简写/优化技巧
- spoj 338
- <;Learning How to Learn>;Week One: Focused versus Diffuse Thinking
- OneAPM x 腾讯 | OneAPM 技术公开课&#183;深圳 报名:前端性能大作战!
- Flask, Tornado, GEvent, 以及它们的结合的性能比较
- 关于jsp页面是放在webroot目录下和web-inf下优缺点
- hhtml from表单为什么能提交数据
- Web开发的绝美网站
- node.js模块之util模块