시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 512 MB | 99 | 45 | 42 | 46.154% |
You are writing out a list of numbers. Your list contains all numbers with exactly Di digits in its decimal representation which are equal to i, for each i between 1 and 9, inclusive. You are writing them out in ascending order.
For example, you might be writing every number with two '1's and one '5'. Your list would begin 115, 151, 511, 1015, 1051.
Given N, the last number you wrote, compute what the next number in the list will be.
The first line of input contains an integer T, the number of test cases in the input. T lines follow, one for each test case, each containing a single integer N.
Limits
For each test case, output
Case #X: K
where X is the test case number, starting from 1, and K is the next integer in the list.
3 115 1051 6233
Case #1: 151 Case #2: 1105 Case #3: 6323
Contest > Google > Code Jam > Google Code Jam 2009 > Round 1B B2번