atcoder#ABC192D. [ABC192D] Base n
[ABC192D] Base n
Score : points
Problem Statement
Given are a string consisting of 0
through 9
, and an integer .
Let be the greatest digit in .
How many different integers not greater than can be obtained by choosing an integer not less than and seeing as a base- number?
Constraints
- consists of
0
through9
. - The length of is between and (inclusive).
- does not begin with a
0
.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
22
10
2
The greatest digit in is 2
.
- By seeing as a base- number, we get .
- By seeing as a base- number, we get .
These two values are the only ones that we can obtain and are not greater than .
999
1500
3
The greatest digit in is 9
.
- By seeing as a base- number, we get .
- By seeing as a base- number, we get .
- By seeing as a base- number, we get .
These three values are the only ones that we can obtain and are not greater than .
100000000000000000000000000000000000000000000000000000000000
1000000000000000000
1
By seeing as a base- number, we get , which is the only value that we can obtain and are not greater than .