309972: CF1766A. Extremely Round

Memory Limit:512 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Extremely Round

题意翻译

给出 $t$ 个 $n$,求出每个 $1 - n$ 范围内只含有一个非零数字的个数。

题目描述

Let's call a positive integer extremely round if it has only one non-zero digit. For example, $ 5000 $ , $ 4 $ , $ 1 $ , $ 10 $ , $ 200 $ are extremely round integers; $ 42 $ , $ 13 $ , $ 666 $ , $ 77 $ , $ 101 $ are not. You are given an integer $ n $ . You have to calculate the number of extremely round integers $ x $ such that $ 1 \le x \le n $ .

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. Then, $ t $ lines follow. The $ i $ -th of them contains one integer $ n $ ( $ 1 \le n \le 999999 $ ) — the description of the $ i $ -th test case.

输出格式


For each test case, print one integer — the number of extremely round integers $ x $ such that $ 1 \le x \le n $ .

输入输出样例

输入样例 #1

5
9
42
13
100
111

输出样例 #1

9
13
10
19
19

Input

题意翻译

给出 $t$ 个 $n$,求出每个 $1 - n$ 范围内只含有一个非零数字的个数。

Output

题目大意:
如果一个正整数只有一个非零数字,那么我们称这个数为"极度圆润"。例如,5000、4、1、10、200都是极度圆润的整数;而42、13、666、77、101则不是。给定一个整数n,你需要计算1到n之间有多少个极度圆润的整数x。

输入输出数据格式:
输入格式:
第一行包含一个整数t(1≤t≤10^4),表示测试用例的数量。
接下来t行,每行包含一个整数n(1≤n≤999999),描述每个测试用例。

输出格式:
对于每个测试用例,输出一个整数,表示1到n之间极度圆润的整数x的数量。

输入输出样例:
输入样例 #1:
```
5
9
42
13
100
111
```
输出样例 #1:
```
9
13
10
19
19
```题目大意: 如果一个正整数只有一个非零数字,那么我们称这个数为"极度圆润"。例如,5000、4、1、10、200都是极度圆润的整数;而42、13、666、77、101则不是。给定一个整数n,你需要计算1到n之间有多少个极度圆润的整数x。 输入输出数据格式: 输入格式: 第一行包含一个整数t(1≤t≤10^4),表示测试用例的数量。 接下来t行,每行包含一个整数n(1≤n≤999999),描述每个测试用例。 输出格式: 对于每个测试用例,输出一个整数,表示1到n之间极度圆润的整数x的数量。 输入输出样例: 输入样例 #1: ``` 5 9 42 13 100 111 ``` 输出样例 #1: ``` 9 13 10 19 19 ```

加入题单

算法标签: