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

34490번 - Number Reduction 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB75571.429%

문제

Busy Beaver is given a positive integer $k$ (1ドル \le k \le 10^{18}$) written in base 10ドル$. Then, he repeatedly performs the following operation:

Choose a digit in $k$ that is greater than 1ドル$. If $k$ is divisible by that digit, divide $k$ by that digit. Repeat this process on the resulting number until either 1ドル$ is reached or there are no more legal operations. Call $k$ valid if there exists a way to reduce it to 1ドル$ via this operation.

Compute the number of $k$ in the range 1,ドル \dots, N$ that are valid.

입력

The first line of input contains the given integer $N$ (1ドル \le N \le 10^{18}$).

출력

Output a single line, with a single integer equivalent to the number of integers from 1ドル$ to $N$ that have a way to reach 1ドル$ using the operation.

제한

서브태스크

번호배점제한
125

$N \le 10^5$.

275

No additional constraints.

예제 입력 1

9

예제 출력 1

9

예제 입력 2

13

예제 출력 2

10

노트

In the first test case, all integers from 1ドル$ to 9ドル$ can be divided by themselves to reach 1ドル,ドル so the answer is 9ドル$.

In the second test case, all integers from 1ドル$ to 9ドル$ are valid, as mentioned in the first test case. 10ドル,ドル 11ドル,ドル and 13ドル$ have no digits greater than 1ドル$ that are divisors of themselves, and therefore cannot be reduced to 1ドル$. However, 12ドル$ can be divided by 2ドル$ to get 6ドル,ドル which can in turn be divided by 6ドル$ to get 1ドル$. Therefore, the numbers 1ドル$ through 9ドル$ and 12ドル$ are valid, giving an answer of 10ドル$.

출처

University > MIT > M(IT)^2 > M(IT)^2 Winter 2025 Tournament > Advanced Round 1 1번

채점 및 기타 정보

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

출처

대학교 대회

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

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