题意:统计在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 ;
}

good bye 2015 B - New Year and Old Property的更多相关文章

  1. Good Bye 2015 B. New Year and Old Property 计数问题

    B. New Year and Old Property   The year 2015 is almost over. Limak is a little polar bear. He has re ...

  2. Codeforces Good bye 2015 B. New Year and Old Property dfs 数位DP

    B. New Year and Old Property 题目连接: http://www.codeforces.com/contest/611/problem/B Description The y ...

  3. Good Bye 2015 B. New Year and Old Property —— dfs 数学

    题目链接:http://codeforces.com/problemset/problem/611/B B. New Year and Old Property time limit per test ...

  4. codeforces Good Bye 2015 B. New Year and Old Property

    题目链接:http://codeforces.com/problemset/problem/611/B 题目意思:就是在 [a, b] 这个范围内(1 ≤ a ≤ b ≤ 10^18)统计出符合二进制 ...

  5. Good Bye 2015 D. New Year and Ancient Prophecy

    D. New Year and Ancient Prophecy time limit per test 2.5 seconds memory limit per test 512 megabytes ...

  6. Good Bye 2015 A. New Year and Days 签到

    A. New Year and Days   Today is Wednesday, the third day of the week. What's more interesting is tha ...

  7. Codeforces Good Bye 2015 A. New Year and Days 水题

    A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wedn ...

  8. Good Bye 2015 C. New Year and Domino 二维前缀

    C. New Year and Domino   They say "years are like dominoes, tumbling one after the other". ...

  9. Codeforces Good Bye 2015 D. New Year and Ancient Prophecy 后缀数组 树状数组 dp

    D. New Year and Ancient Prophecy 题目连接: http://www.codeforces.com/contest/611/problem/C Description L ...

随机推荐

  1. 4.0 spring-注册解析的Bean

    1.0 registerBeanDefinition 对于配置文件,解析也解析完了,装饰也装饰完了,对于得到的BeanDefinition已经可以满足后续的使用了,唯一剩下的工作就是注册了, 也就是: ...

  2. 【搜索】BZOJ 3990: 【Sdoi 2015】排序

    3990: [SDOI2015]排序 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 336  Solved: 164[Submit][Status][ ...

  3. win8 优化笔记

    win8可以关掉的服务: 以下是小编搜集的可以安全更改为手动启动的服务(按名称排序): Application Experience(启动时为程序处理应用程序兼容性缓存请求) ·Computer Br ...

  4. hdu 4648

    求一个数列中  去掉一些连续的数之后 不改变对m取余后的值 就是求一个最长的连续子序列 对m取余后为0 我的方法可能比较水 #include<iostream> #include<c ...

  5. hdu 4559 涂色游戏 博弈论

    构造SG函数:sg[i]表示2*i的sg值!! 代码如下: #include<iostream> #include<stdio.h> #include<algorithm ...

  6. java 布尔值一种赋值方法

    在研读jmeter的代码时发现一个很常见的布尔值赋值方式,记录下来备忘: public static void main(String[] args) { // TODO Auto-generated ...

  7. Vue.js vui 饿了么Vue2.0的组件库

    http://www.oschina.net/news/78038/vue-js-2-0-3 http://git.oschina.net/durcframework/vui http://eleme ...

  8. C#获取cpu序列号 硬盘ID 网卡硬地址以及操作注册表 .

    转:http://blog.csdn.net/smartsmile2012/article/details/8682295 #region 获取cpu序列号 硬盘ID 网卡硬地址 /**/ /// & ...

  9. 关于hadoop的环境变量

    export PATH export JAVA_HOME=/opt/jdk1.7 export PATH=$PATH:$JAVA_HOME/bin 为什么/etc/profile 添加了环境变量had ...

  10. [原]捉虫记3:_ConectionPtr指针调用open失败

    背景 产品使用MySQL来存储报警服务产生的报警.在报警服务的组件中使用ADO接口 客户方有两台计算机,一台计算机A用来组态,且可以对设备进行调试,操作系统是Win7 64bit 专业版,安装了VS2 ...