题目描述
Define the ''digit product'' f(x) of a positive integer x as the product of all its digits. For example, f(1234)=1×2×3×4=24, and f(100)=1×0×0=0.
Given two integers l and r, please calculate the following value:
(i=l∏rf(i))mod(109+7)
In case that you don't know what ∏ represents, the above expression is the same as
(f(l)×f(l+1)×⋯×f(r))mod(109+7)输入格式
There are multiple test cases. The first line of the input contains an integer T (about 105), indicating the number of test cases. For each test case:
The first and only line contains two integers l and r (1≤l≤r≤109), indicating the given two integers. The integers are given without leading zeros.
输出格式
For each test case output one line containing one integer indicating the answer.
题目大意
【题目描述】
定义正整数 x 的 "数字乘积" f(x) 为其所有数字的乘积。例如,f(1234)=1×2×3×4=24,f(100)=1×0×0=0。
给定两个整数 l 和 r,请计算以下值:
(i=l∏rf(i))mod(109+7)
如果你不知道 ∏ 表示什么,上述表达式等同于
(f(l)×f(l+1)×⋯×f(r))mod(109+7)【输入格式】
有多个测试用例。输入的第一行包含一个整数 T(大约 105),表示测试用例的数量。对于每个测试用例:
第一行且唯一一行包含两个整数 l 和 r(1≤l≤r≤109),表示给定的两个整数。这些整数没有前导零。
【输出格式】
对于每个测试用例,输出一行,包含一个整数,表示答案。
【样例解释】
对于第一个样例测试用例,答案是 9!mod(109+7)=362880。
对于第二个样例测试用例,答案是 (f(97)×f(98)×f(99))mod(109+7)=(9×7×9×8×9×9)mod(109+7)=367416。
翻译来自于:ChatGPT。
提示
For the first sample test case, the answer is 9!mod(109+7)=362880.
For the second sample test case, the answer is (f(97)×f(98)×f(99))mod(109+7)=(9×7×9×8×9×9)mod(109+7)=367416.