language: C++ (gcc-4.3.4)
date: 109 days 16 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
#include<math.h>
int main(){
int i,j,l,a,k,rev=0,t,r[7];
scanf("%d\n",&t);
i=0;
while(i<t)
{ scanf("%d\n",&k);
    if(k<=1000000)
    {k++; 
     while(k<=1000000)
      { a=k;j=0;
        do{ r[j]=k%10; j++;
           }
          while((k=(k/10))>0);
     l=0;
    while((j--)>0) { rev=rev+r[l]*pow(10,j);l++;}
    if(a!=rev){k++; }
      else{printf("%d\n",rev);break;}
       }
     }i++;
}
return(0);
}