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ớ:
256M
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 move, you may subtract one of the digits from the number.
What is the minimum number of moves to make the number equal to ~0~?
Input
- The only integer ~N~ ~(0 ≤ N ≤ 10^7)~.
Output
- The minimums number of moves.
Sample Input 1
18
Sample Output 1
3
Sample Input 2
20
Sample Output 2
4
Notes:
- Sample ~1~: ~18 \to 18~ – ~8 = 10\to10~ – ~1 = 9\to9~ – ~9 = 0~
- Sample ~2~: ~20\to18\to10\to9\to0~
Bình luận