CF288E.Polo the Penguin and Lucky Numbers
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Everybody knows that lucky numbers are positive integers that contain only lucky digits 4 and 7 in their decimal representation. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Polo the Penguin have two positive integers l and r (l < r), both of them are lucky numbers. Moreover, their lengths (that is, the number of digits in the decimal representation without the leading zeroes) are equal to each other.
Let's assume that n is the number of distinct lucky numbers, each of them cannot be greater than r or less than l, and a__i is the i-th (in increasing order) number of them. Find _a_1·_a_2 + _a_2·_a_3 + ... + a__n - 1·a__n. As the answer can be rather large, print the remainder after dividing it by 1000000007 (109 + 7).
众所周知,幸运数是指十进制表示中仅包含幸运数字 4 和 7 的正整数。例如,47、744、4 是幸运数,而 5、17、467 则不是。
企鹅波洛有两个正整数 l 和 r(满足 l<r),它们均为幸运数,且它们的长度(即十进制表示中不含前导零的位数)相等。
设 n 为所有满足 l≤ai≤r 的互不相同的幸运数的个数,且 ai 表示其中第 i 小的数(按升序排列)。请计算 a1⋅a2+a2⋅a3+⋯+an−1⋅an。由于答案可能非常大,请输出其对 1000000007(即 109+7)取模的结果。
输入格式
The first line contains a positive integer l, and the second line contains a positive integer r (1 ≤ l < r ≤ 10100000). The numbers are given without any leading zeroes.
It is guaranteed that the lengths of the given numbers are equal to each other and that both of them are lucky numbers.
第一行包含一个正整数 l,第二行包含一个正整数 r(1 ≤ l < r ≤ 10100000)。所给数字均不含前导零。
保证所给两个数字的长度相等,且二者均为幸运数字。
输出格式
In the single line print a single integer — the answer to the problem modulo 1000000007 (109 + 7).
在单行中输出一个整数——该问题答案对 1000000007(即 109+7)取模的结果。
输入输出样例
输入#1
4 7
输出#1
28
输入#2
474 777
输出#2
2316330
输入解题思路,AI测评打分。不知道怎么写?