Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||||||||||
2018-09-28 19:18:27
AC in one go :) |
||||||||||||||
2018-09-19 07:48:53
Wrong answers a few times. After changing fgets to scanf, the same code works well! (language C). |
||||||||||||||
2018-09-02 17:55:14
naruto17 read question clearly |
||||||||||||||
2018-09-02 07:44:57
A great problem with a variety of test cases , so before careful about all the possibilities. |
||||||||||||||
2018-08-28 07:10:21
getting time exceeded.. |
||||||||||||||
2018-08-25 09:27:05
it says time limit exceeded..ran it on ideone.com and total time taken was 0.04s |
||||||||||||||
2018-08-19 22:02:21
for run time errors ; try this 1 9999999999 ans : 10000000001 u will get the answer surely. |
||||||||||||||
2018-08-04 21:17:51
Check for '9' Input 9 Output 11 |
||||||||||||||
2018-07-15 17:44:49
Do we need to consider -ve numbers as well? |
||||||||||||||
2018-07-15 12:39:04
Run time error in python3 I am defining a function for solving the problem |