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
|
||||||||||||||
2014-06-02 10:23:56 Mitch Schwartz
@Łukasz Kuszner: Thank you! |
||||||||||||||
2014-06-02 08:42:37 kuszi
@Mitch Schwartz && cegprakash: after the long rejudge it appeared that about 30% of previously accepted solutions was incorrect. Thank you very much! Last edit: 2014-06-02 08:43:36 |
||||||||||||||
2014-05-13 15:09:33 Dmitri
Was worried if my program would take 1 000 000 chars string with Console.ReadLine() in C#. But got solution accepted at the first attempt :) |
||||||||||||||
2014-04-24 20:24:06 The Mama of Coding
awesome problem!!! but not for beginners... took me 6 hours to fully understand it. thumbs up |
||||||||||||||
2014-02-12 06:51:43 ANKIT KUMAR CODOPEDIAC
can u plz tell me at which test case this is giving wrong ans? [code removed] "1. Don't post any source code here." Last edit: 2014-02-12 08:04:04 |
||||||||||||||
2014-01-15 18:57:58 cegprakash
The problem's worth will increase after rejudge! |
||||||||||||||
2014-01-15 16:16:38 Mitch Schwartz
@Łukasz Kuszner: Thanks! Moved back to classical. Will there be a rejudge? I can understand if it's too much work for the servers to rejudge over 70k submissions, considering also that the problem is currently worth < 0.01 points. |
||||||||||||||
2014-01-15 15:23:59 kuszi
Tests are a little stronger, what about moving it back to classical? |
||||||||||||||
2014-01-15 15:17:31 Mitch Schwartz
Moved to tutorial. |
||||||||||||||
2014-01-15 15:17:31 Subhasish Saha
Many people have commented but still test cases have not been corrected!!! For input 523526236747348343262362486125986592, accepted solution gave 523526236747348344443843747632625325. Whereas correct output is 523526236747348343343843747632625325. Is there any admin/moderator? |