Logo
(追記) (追記ここまで)

12645번 - The Next Number (Small) 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB3001139136.842%

문제

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

  • 1 ≤ T ≤ 50
  • 1 ≤ N ≤ 106

출력

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.

제한

예제 입력 1

3
115
1051
6233

예제 출력 1

Case #1: 151
Case #2: 1105
Case #3: 6323

힌트

출처

Contest > Google > Code Jam > Google Code Jam 2009 > Round 1B B1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /