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
题目大意:S(x)为求x用十进制数表达时各个位置上的数之和,比如S(123)=1+2+3=6;现在让你输入一个x,求一个k使S(k*x)%233=0;
思路:很很很巧妙;S(9)=9=1*9 S(2*9)=1+8=9=1*9 S(3*9)=2+7=9=1*9;
S(99)=9+9=2*9 S(99*2)=1+9+8=18=9*2;
S(999)=9+9+9=27; S(999*3)=S(2997)=9*3
由上可以知道规律当99999....9(233个9)乘以任何一个数它的S都是233*9;
所以直接输出233个9就A了
本文介绍了一种巧妙的方法来解决数学问题:对于任意正整数x,找到一个正整数k,使得S(k*x)除以233的余数为0。S(x)定义为x的十进制表达中所有数字的和。通过观察发现,当k为连续233个9组成的数字时,S(k*x)总是能被233整除。
&spm=1001.2101.3001.5002&articleId=78004177&d=1&t=3&u=ebd520dd24bb4154a0774698242c885c)
644

被折叠的 条评论
为什么被折叠?



