//题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27048#problem/G
没什么好说的,直接暴力.....= =
1 #include<iostream>
2 #include<string.h>
3 #include<cstdio>
4 using namespace std;
5
6 #define M 1000000
7 char a[M];
8 int b[M];
9
10 int main()
11 {
12 int T,i,x,j;
13 scanf("%d",&T);
14 while(T--)
15 {
16
17 int num=0;
18 scanf("%s",a);
19 x=strlen(a);
20 memset(b,0,sizeof(b));
21 for(i=1;i<=x;i++)
22 {
23 b[i]=a[x-i]-48;
24 }
25 for(;;)
26 {
27 b[1]++;
28 i=1;
29 while(b[i]>9)
30 {
31 if(i==x)
32 {
33 x++;
34 b[x]=0;
35 }
36
37 b[i]=0;
38 b[++i]++;
39 }
40 for(j=1,num=0;j<=x;j++)
41 num+=b[j];
42 if(num%10==0) break;
43 }
44 for(i=x;i>1;i--)
45 printf("%d",b[i]);
46 printf("%d
",b[1]);
47 }
48 return 0;
49 }