Divisibility

TimeLimit:1000MS  MemoryLimit:65536KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
You are given two $10$-based integers $b$ and $x$, and you are required to determine the following proposition is true or false:

For arbitrary $b$-based positive integer $y = \overline{c_1 c_2 \cdots c_n}$ ($c_i$ is the $i$-th dight from left of $y$), define $\displaystyle f(y) = \sum_{i=1}^n c_i$, if $\underbrace{f( f( \cdots f(y) \cdots ))}_{\infty}$ can be divided by $x$, then $y$ can be divided by $x$, otherwise $y$ can't be divided by $x$.
Input
The first line contains a $10$-based integer $t\ (1 \leq t \leq 10^5)$ — the number of test cases.

For each test case, there is a single line containing two $10$-based integers $b$ and $x \ (2 \leq b,x \leq 10^{18})$.
Output
For each test case, if the proposition is true, print "T", otherwise print "F" (without quotes).
SampleInput
1
10 3
SampleOutput
T
Submit
题目统计信息详细
总AC数3
通过人数3
尝试人数3
总提交量5
AC率60.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

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