Rikka with Number

TimeLimit:4000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:

In radix $d$, a number $K=(A_1A_2...A_m)_d(A_i \in [0,d),A_1 \neq 0)$ is good if and only $A_1-A_m$ is a permutation of numbers from $0$ to $d-1$.

A number $K$ is good if and only if there exists at least one $d \geq 2$ and $K$ is good under radix $d$.

Now, Yuta wants to calculate the number of good numbers in interval $[L,R]$

It is too difficult for Rikka. Can you help her?  
Input
The first line contains a number $t(1 \leq t \leq 20)$, the number of the testcases.

For each testcase, the first line contains two decimal numbers $L,R(1 \leq L \leq R \leq 10^{5000})$.
Output
For each testcase, print a single line with a single number -- the answer modulo $998244353$.
SampleInput
2
5 20
123456 123456789
SampleOutput
3
114480
Submit
题目统计信息详细
总AC数1
通过人数1
尝试人数1
总提交量3
AC率33.33%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: