← 返回 amazon 的题目列表Number of Digit One
类型:online_judge
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.
Input:
An integer n (1 <= n <= 10^9)
Output:
The count of digit 1 appearing from 1 to n.
Example:
Input: 13
Output: 6
Explanation: The numbers containing digit 1 are 1, 10, 11, 12, 13.
Example
Input
13