CSES - Removing Digits
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
You are given an integer ~n~. On each step, you may subtract one of the digits from the number.
How many steps are required to make the number equal to ~0~?
Input
- The only input line has an integer ~n~.
Output
- Print one integer: the minimum number of steps.
Constraints
- ~1 \le n \le 10^6~
Example Input
27
Example Output
5
Explanation: An optimal solution is ~27 \rightarrow 20 \rightarrow 18 \rightarrow 10 \rightarrow 9 \rightarrow 0~.
Bình luận