Staircase Numbers (APCS 2018-02 Expert)
2.0s 256MA positive integer is a staircase number when its decimal digits never decrease from left to right, such as \(9,112,777\). Count staircase numbers at most \(N\). Leading zeros are forbidden and zero is excluded.
Input Format
Read an integer \(N\).
Output Format
Print the count.
Constraints
\(1\le N\le10^{18}\).
Sample Input 1
25
Sample Output 1
22
Sample Input 2
101
Sample Output 2
54
Source
APCS 2018-02 public archive version: tcirc:d080。
Log in to write and submit code.
Log in