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
|
||||||||||||||
2015-05-27 12:59:39 Nitesh Tiwari
Hi, I'm getting RUNTIME ERROR SEGABRT. I'm not able to understand about what's causing this problem, Here's the ideone link, <snip> Any help would be appreciated. Last edit: 2022-07-26 22:23:27 |
||||||||||||||
2015-05-25 19:43:24 SON_OF_SPARDA
problem took time but... yahoo AC in first attempt :) |
||||||||||||||
2015-05-22 14:49:42
All sorts of test cases checked but still getting a WA, can anybody pls check? Code : <snip> Had to post it here. Tried registering in the forum 2 times with different email but they never sent a confirmation. Last edit: 2022-07-26 22:23:36 |
||||||||||||||
2015-05-22 12:53:23 Ptotheextreme
i have fallen into the "i have every test correct but still WA" club... |
||||||||||||||
2015-05-19 11:25:17
How many test cases max? Is it mentioned anywhere? Last edit: 2015-05-19 11:46:04 |
||||||||||||||
2015-05-18 17:51:56
How can I "like" this problem ? |
||||||||||||||
2015-05-17 15:26:22 Rakend Chauhan
finally got it right! |
||||||||||||||
2015-05-15 14:19:24 shivam chandra
9 4 1 8 7 9 7 8 3 2 2------------>9 4 1 8 8 0 8 8 1 4 9 not able to rectify this case i m getting output till 941879783 can anyone help me in this ? |
||||||||||||||
2015-05-14 08:07:16
Finally! Got it right!! I feel like I should get a trophy for this. :) Then again, I need to improve upon checking for various scenarios. It took me many attempts. A humbling experience. Last edit: 2015-05-14 21:31:44 |
||||||||||||||
2015-05-12 08:41:39
Hi, on all colected in comments cases I get correct answer but still I get WA in jugde system. (see: <snip> ) @Anakar Parida: I think you should consider the resigne from the use of BigDecimal. Last edit: 2022-07-26 22:23:43 |