Define the function S(x) for x is a positive integer. S(x) equals to the sum of all digit of the decimal expression of x. Please find a positive integer k that S(k∗x)%233=0.
Input Format
First line an integer T, indicates the number of test cases (T≤100). Then Each line has a single integer x(1≤x≤1000000)indicates i-th test case.
Output Format
For each test case, print an integer in a single line indicates the answer. The length of the answer should not exceed 2000. If there are more than one answer, output anyone is ok.
样例输入
1 1
样例输出
89999999999999999999999999
题意:
对于正整数x,S(x)为x的所有位数相加,
问你是否存在一个数k,使S(k*x)%233=0.
思路:找规律,当时发现233是8+25×9...于是打算就先不考虑8,开始假设如果数是225看看能不能找到什么规律,因为225就是25个9相加嘛。
发现1×9=9 ,2×9=18 ,3×9=27 …S(任何数×9) 等于一个9=9.
1×99=99,2×99=198,3×99=297.. S(任何数×99)等于两个9相加=18
于是推到mod等于225,也就是25个9...S(任何数×25个9)等于25个9相加=225
那mod是233怎么办呢,因为还有个8要处理,然后再想…
突然队友直接输出k=233个9..AC,我晕死,然后恍然大悟,S(任何数×233个9)等于233个9相加 那(233个9相加)%233不就等于0吗。
于是答案就是输出233个9...
ACcode:
#include <cstdio>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
printf("99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
}
return 0;
}