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

9960번 - Digit Sums 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB40232155.263%

문제

Given 3 positive integers A, B and C, find how many positive integers less than or equal to A, when expressed in base B, have digits which sum to C.

입력

Input will consist of a series of lines, each containing three integers, A, B and C, 2 ≤ B ≤ 100, 1 ≤ A, C ≤ 1,000,000,000. The numbers A, B and C are given in base 10 and are separated by one or more blanks. The input is terminated by a line containing three zeros.

출력

Output will be the number of numbers, for each input line (it must be given in base 10).

제한

예제 입력 1

100 10 9
100 10 1
750000 2 2
1000000000 10 40
100000000 100 200
0 0 0

예제 출력 1

10
3
189
45433800
666303

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2007 N번

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

출처

대학교 대회

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

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