Numbers containing 0's from 1 to N
Basic Accuracy: 49.49% Submissions: 1159 Points: 1

Efficiently count how many integers from 1 to N contains 0's as a digit. 

Input:
First line of the input contains the number of test cases T. Each line of test case contains the integer N.

Output:
Number of integers that contain 0 as a digit are printed.

Constraints:
1 <=T<= 100
1 <=N<= 10000

Example:
Input:

3
100
987
20

Output:
10
179
2

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.