#Z14405. 数1的个数
数1的个数
Description
Given a positive decimal integer n (1 ≤ n ≤ 10000), write down all integers from 1 to n, then count the number of times the digit "1" appears.
For example, when n=2, the numbers written are 1, 2. In this case, only one "1" appears. When n=12, the numbers written are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. Here, the digit "1" appears five times.
Input Format
A positive integer n, where 1 ≤ n ≤ 10000.
Output Format
A positive integer representing the count of "1"s.
12
5