AtCoder Regular Contest 174
翻译中…
Problem Statement
翻译中…
Solve the following problem for $T$ test cases.
翻译中…
Given an integer $N$, find the number of integers $x$ that satisfy all of the following conditions:
翻译中…
$1 \le x \le N$- Let
$y = \lfloor \sqrt{x} \rfloor$. When$x$and$y$are written in decimal notation (without leading zeros),$y$is a prefix of$x$.
翻译中…
Constraints
翻译中…
$T$is an integer such that$1 \le T \le 10^5$.$N$is an integer such that$1 \le N \le 10^{18}$.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
T
N_1
N_2
\vdots
N_T
翻译中…
Here, $N_i$ represents the integer $N$ for the $i$-th test case.
翻译中…
Output
翻译中…
Print $T$ lines in total. The $i$-th line should contain the answer for the $i$-th test case as an integer.
翻译中…
样例
Input #1
2
1
174
Output #1
1
22
This input contains two test cases.
- For the first test case, $x=1$ satisfies the conditions since $y = \lfloor \sqrt{1} \rfloor = 1$.
- For the second test case, for example, $x=100$ satisfies the conditions since $y = \lfloor \sqrt{100} \rfloor = 10$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。