문제1615--RepresentableNumbers

1615: RepresentableNumbers

실행시간 제한: 20 Sec  메모리사용 제한: 128 MB
제출: 51  통과: 20
[제출] [채점기록] [묻고답하기]

문제 설명

Let's call a positive integer A totally odd if each digit in its decimal notation is odd, i.e., one of 1, 3, 5, 7, 9. For example, integers 9, 513, 77777 are totally odd and integers 2 and 99990 are not. 

A positive integer N is called representable if it can be represented as N = A + B, where both A and B are totally odd numbers. For example, 2 = 1 + 1 and 4752 = 1377 + 3375 are representable, while 3 and 220 are not. 

Given an int X, print the smallest representable number that is greater than or equal to X.

입력 설명

The first line of the input gives the number of test cases, T (1 <= T <= 200).

For each test case, one positive integer x, which is between 1 and 100,000,000, inclusive, will be given in one line.

출력 설명

For each test case, print the smallest representable number as explained in the problem statement, in one line.

입력 예시 Copy

5
1
999
2000
4201234
10101010

출력 예시 Copy

2
1000
2000
4222222
10102222

출처/분류