限制:1000ms 32768K
Define the function S(x) for xx 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

看来脑洞不够大。。。。

方法一:直接输出233个9。因为任何正整数乘以9的数位和都是9的倍数。。。

#include <iostream>
using namespace std; int main()
{
int T,n;
cin>>T;
while(T--){
cin>>n;
for(int i=;i<=;i++){
cout<<;
}
cout<<endl;
}
return ;
}

方法二:

当x<10时可以直接输出233个x,当1000>x>=10时,不妨设k*x=233个x,那么k=10(233个10),当1000<=x<10000,k=100(233个100),等等。手动模拟一下就懂了。

 #include <iostream>
using namespace std; int main()
{
int T,n;
cin>>T;
while(T--){
cin>>n;
int tmp=n;
int len=;
while(n){
len++;
n/=;
} if(len==){
for(int i=;i<;i++)
cout<<tmp;
}else if(len==){
for(int i=;i<;i++)
cout<<"";
}else if(len==){
for(int i=;i<;i++)
cout<<"";
}else if(len==){
for(int i=;i<;i++)
cout<<"";
}else if(len==){
for(int i=;i<;i++)
cout<<"";
}else{
for(int i=;i<;i++)
cout<<"";
}
cout<<endl;
}
return ;
}
05-11 20:43