PALIN - The Next Palindrome
A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros.
The first line contains integer t, the number of test cases. Integers K are given in the next t lines.
For each K, output the smallest palindrome larger than K.
Warning: large Input/Output data, be careful with certain languages
AC in One GO . . . . .
ac in first attempt....:)
I am getting a runtime error but the program works fine on my computer and in ideone
getting error time limit exceed!!
Very good question but in my case it shows time limit exceeded.Some one please help me and check my code its in C
nguyễn vãn lâm:
the only once, accepted!..Last edit: 2015-09-23 19:29:01
I am also getting NZEC error...
@almas - because we have to find next palindrome. 2112<2133 and 2133<2222.
For the second case why output can't 2112 which is less than 2222?
tried like some 500 test cases
|Cluster:||Cube (Intel Pentium G860 3GHz)|
|Languages:||All except: NODEJS PERL 6|