Zgodan
의견: 0
\(5^{th}\) round, January \(17^{th}\) 2015
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.
In test cases worth 56 points, it will hold \(N < 10^{9}\).
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
5801001output
12 14
5810101평가 및 의견
Zgodan
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Zgodan