Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

NEXTPREV - The next and the previous palindrome


The input consist of unknown number (lower than 100) of tests. Each test is a line with two integers x and y (0<=x<=2*109, length of y is at most 1000).


For each test You should print:

  • the next palindrome of y - if x is even
  • the previous palindrome of y - if x is odd


10 9029
11 9029 Output:

Note: Leading zeroes don't occur in the input and shouldn't occur in the output.

Added by:Piotr Kąkol
Time limit:1.620s-3.286s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi

hide comments
2012-03-19 09:00:01 Piotr KÄ…kol
@De bugging - Your reading is invalid. Do not use cin.eof() unless You really need it.
2012-03-18 08:41:35 debugging
Could You write me what's wrong with #6677687 output?
2011-07-01 12:49:06 Piotr KÄ…kol
@Jander - No negavite numbers at all.
2011-06-30 10:28:50 Jander
Just for further clarification of hallvabo's question, can y be negative ? Ie we have to handle palindromes of -1234 for example.
2011-06-28 22:14:53 Piotr KÄ…kol
@hallvabo - Yes, for y=0 You print 2 instead of 1. But y>0 for previous palindrome.
2011-06-28 20:43:57 Hallvard Norheim Bø
Can y be less than 1?
For what input does #5309983 fail?
2011-06-16 17:18:14 Piotr KÄ…kol
@hallvabo - 9
I added a note.
Thanks for Your remark.
2011-06-16 12:04:12 HWK
@Piotr: Thanks but seems there are more special cases. I'll look for them.

Last edit: 2011-06-17 13:33:55
2011-06-15 21:16:05 Hallvard Norheim Bø
What about leading zeroes?
11 11 => 010 or 9?
2011-06-15 20:17:28 Piotr KÄ…kol
Of course. :-)
101 10 -> 9 not 00
© All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.