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

24842번 - Interesting Integers 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
20 초 (추가 시간 없음) 1024 MB171392322.772%

문제

Let us call an integer interesting if the product of its digits is divisible by the sum of its digits. You are given two integers $A$ and $B$. Find the number of interesting integers between $A$ and $B$ (both inclusive).

입력

The first line of the input gives the number of test cases, $T$. $T$ lines follow.

Each line represents a test case and contains two integers: $A$ and $B$.

출력

For each test case, output one line containing Case #x: y, where $x$ is the test case number (starting from 1) and $y$ is the number of interesting integers between $A$ and $B$ (inclusive).

제한

  • 1ドル≤T≤100$.

Test Set 1 (11점)

  • 1ドル≤A≤B≤10^5$.

Test Set 2 (24점)

  • 1ドル≤A≤B≤10^{12}$.

예제 입력 1

4
1 9
91 99
451 460
501 1000

예제 출력 1

Case #1: 9
Case #2: 0
Case #3: 5
Case #4: 176

힌트

In Sample Case #1, since the product and the sum of digits are the same for single-digit integers, all integers between 1ドル$ and 9ドル$ are interesting.

In Sample Case #2, there are no interesting integers between 91ドル$ and 99ドル$.

In Sample Case #3, there are five interesting integers between 451ドル$ and 460ドル$:

  1. 451ドル$ (product of its digits is 4ドル×5×1=20,ドル sum of its digits is 4ドル+5+1=10$).
  2. 453ドル$ (product of its digits is 4ドル×5×3=60,ドル sum of its digits is 4ドル+5+3=12$).
  3. 456ドル$ (product of its digits is 4ドル×5×6=120,ドル sum of its digits is 4ドル+5+6=15$).
  4. 459ドル$ (product of its digits is 4ドル×5×9=180,ドル sum of its digits is 4ドル+5+9=18$).
  5. 460ドル$ (product of its digits is 4ドル×6×0=0,ドル sum of its digits is 4ドル+6+0=10$).

출처

Contest > Google > Kick Start > Google Kick Start 2022 > Round A D번

채점 및 기타 정보

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

출처

대학교 대회

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

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