A8893 | Polo the Penguin and Lucky Numbers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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$ ( $10^{9}+7$ ).
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$ ( $10^{9}+7$ ).
输入格式
The first line contains a positive integer $l$ , and the second line contains a positive integer $r$ ( $1<=l<r<=10^{100000}$ ). 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.
It is guaranteed that the lengths of the given numbers are equal to each other and that both of them are lucky numbers.
输出格式
In the single line print a single integer — the answer to the problem modulo $1000000007$ ( $10^{9}+7$ ).
输入输出样例
输入 #1
4 7
输出 #1
28
输入 #2
474 777
输出 #2
2316330
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted