시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 32 MB | 33 | 18 | 17 | 56.667% |
An integer is considered handsome if every two of its consecutive digits are of different parity. For a given integer N, what is its closest handsome number?
Please note: Numbers consisting of only one digit are handsome numbers. The distance of two numbers is the absolute value of their difference.
The first and only line of input contains the positive integer N that consists of at most thousand digits and is not handsome.
The first and only line of output must contain the required closest handsome number. If two closest numbers exist, output the smaller number first and then the larger one and separate them by a single space.
13
12 14
5801001
5810101
Contest > Croatian Open Competition in Informatics > COCI 2014/2015 > Contest #5 4번