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.
Input
The first line contains integer t, the number of test cases. Integers K are given in the next t lines.
Output
For each K, output the smallest palindrome larger than K.
Example
Input: 2 808 2133 Output: 818 2222
Warning: large Input/Output data, be careful with certain languages
hide comments
aditiwari:
2015-06-02 20:43:13
getting sigsegv error.....
|
|
Alex Reimann Cunha Lima:
2015-05-31 05:43:34
Unfortunately this problem is WRONG! Single digits ARE palindromes (source: http://en.wikipedia.org/wiki/Palindromic_number), but you will keep getting WA until you make sure to print "11" whenever the input is a single digit. |
|
neriv:
2015-05-30 21:49:36
please check it......tried everything
|
|
Guruvamsi :
2015-05-29 16:04:34
this site is pathetic when it comes to dealing with wrong formats this is what makes me want to quit
|
|
Hugo:
2015-05-28 21:02:52
still having problems using python with large numbers, despite my tests are correct Last edit: 2015-05-28 21:04:29 |
|
Hugo:
2015-05-28 20:28:21
pick up the next one |
|
Barun Parruck:
2015-05-28 11:06:34
What do we do if the given number is a palindrome? Last edit: 2015-05-28 11:07:05 |
|
Nitesh Tiwari:
2015-05-27 12:59:39
Hi, I'm getting RUNTIME ERROR SEGABRT.
|
|
SON_OF_SPARDA:
2015-05-25 19:43:24
problem took time but...
|
|
deep_07:
2015-05-22 14:49:42
All sorts of test cases checked but still getting a WA, can anybody pls check?
|
Added by: | adrian |
Date: | 2004-05-01 |
Time limit: | 2s-9s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 |