Submit | All submissions | Best solutions | Back to list |
EI2122Q1ADAF2 - Minimum number of moves |
You are given an integer N (0 ≤ N ≤ 107). 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.
Output
The minimums number of moves.
Sample
Input |
Output |
18 |
3 |
20 |
4 |
* Hints: 18 -> 18 – 8 = 10 -> 10 – 1 = 9 -> 9 – 9 = 0
20 -> 18 -> 10 -> 9 -> 0
Added by: | Ha Minh Ngoc |
Date: | 2021-12-20 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |