Interesting Numbers
Given an integer n, determine how many integers x (where 1 ≤ x ≤ n) are interesting. An integer x is considered interesting if the sum of its digits decreases when incremented by 1, i.e., S(x+1) < S(x), where S(x) represents the sum of the digits of x in the decimal system.
Your task is to count how many such interesting numbers exist within the given range.
Example 1
Input:
9
Output:
1
Example 2
Input:
19
Output:
2
Example 3
Input:
1
Output:
0
main.cpp
C++
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione