当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6488:Binary

题目描述
As we all know, computer uses binary code to compute. Each decimal digit can be represented by a string of 0/1:

Decimal  0  1  2  3  4  5  6  7  8  9
Binary  0  1  10  11  100  101  110  111  1000  1001

We are going to transfer all the integers from L to R, both inclusive, with each decimal digit to binary. For example, after transferring decimal integer 127 to our binary representation, we can get 110111, because 1 is 1, 2 is 10 and 7 is 111. Happily, we find that n continuous bits s[i] have values v[i] associated with them. For a decimal number, after transferring to binary, if s[i] appears in it for k times, the value of if will be added k*v[i]. Now we want you to calculate the sum of value for each integer from L to R.
Since the answer may be very large, you just need to output it mod 1000000007.
输入解释
The first line of the input contains a single integer T denoting the number of test cases.
For each test case, the first line contains a single integer n denoting the number of valuable continuous bits.
Then comes n lines, each line has a string s contains only 0 and 1 and an integer v denoting the value.
The last line has two integers L and R.
输出解释
For each test case, output a single integer—the sum of value for each integer from L and R.
输入样例
1
2
010 2
101 3
1 20
输出样例
6
提示
T<=10
n<=100,length(s)<=100,val<=100
L<=R<=10^100
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6488

最后修改于 2020-10-25T23:31:47+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)