CF611B.New Year and Old Property
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The year 2015 is almost over.
Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary system — 201510 = 111110111112. Note that he doesn't care about the number of zeros in the decimal representation.
Limak chose some interval of years. He is going to count all years from this interval that have exactly one zero in the binary representation. Can you do it faster?
Assume that all positive integers are always written without leading zeros.
2015 年即将结束。
Limak 是一只小北极熊。他最近学习了二进制系统。他注意到,刚刚过去的一年(2015)在二进制表示中恰好包含一个零:201510=111110111112。注意,他对十进制表示中的零的个数并不关心。
Limak 选择了一个年份区间。他打算统计该区间内所有在二进制表示中恰好包含一个零的年份。你能比他更快地完成这项统计吗?
假设所有正整数均以无前导零的形式书写。
输入格式
The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 1018) — the first year and the last year in Limak's interval respectively.
输入仅包含一行,其中有两个整数 a 和 b(1 ≤ a ≤ b ≤ 1018),分别表示 Limak 所考虑年份区间的起始年份和结束年份。
输出格式
Print one integer – the number of years Limak will count in his chosen interval.
输出一个整数——Limak 在他选择的区间内将要计数的年份数。
输入输出样例
输入#1
5 10
输出#1
2
输入#2
2015 2015
输出#2
1
输入#3
100 105
输出#3
0
输入#4
72057594000000000 72057595000000000
输出#4
26
说明/提示
In the first sample Limak's interval contains numbers 510 = 1012, 610 = 1102, 710 = 1112, 810 = 10002, 910 = 10012 and 1010 = 10102. Two of them (1012 and 1102) have the described property.
在第一个样例中,Limak 的区间包含数字 510=1012、610=1102、710=1112、810=10002、910=10012 和 1010=10102。其中有两个数(1012 和 1102)具有所描述的性质。
输入解题思路,AI测评打分。不知道怎么写?