#abc222g. G - 222
G - 222
Score : points
问题描述
我们有一个序列 ,其中第 项是一个由全部为 的数字组成的 位整数。
在这个序列中,首次出现 的倍数是在哪个位置?如果第一个 的倍数是序列中的第 项,则输出 ;如果没有 的倍数出现,则输出 -1
。
给定 个测试用例,请分别解决它们。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a sequence , where the -th term is an -digit integer whose digits are all .
Where does a multiple of appear in this sequence for the first time? If the first multiple of is the -th term of the sequence, print ; if there is no multiple of , print -1
.
Given cases, solve each of them.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines. The -th line should contain the answer for .
Sample Input 1
4
1
7
10
999983
Sample Output 1
1
6
-1
999982
We have four cases.
- is a multiple of .
- None of is a multiple of , but is.
- None of is a multiple of .
update @ 2024/3/10 09:48:11