| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 256 MB | 7 | 5 | 5 | 71.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.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 25 | $N \le 10^5$. |
| 2 | 75 | No additional constraints. |
9
9
13
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번