#P1795. 无穷的序列
无穷的序列
Description
There is a sequence with infinitely many elements, $A_i=\overline{1\underbrace{000\dots0}_{i-1\text{ zeros}}}$. There is another infinite sequence , $B=\overline{\underbrace{A_1A_2A_3A_4\dots}_{\text{the }i\text{-th is }A_i}}$, where denotes concatenating and , and similarly for more numbers.
Thus, the first several digits of the infinite sequence are: .
Please find the digit at the specified position in the infinite sequence .
Input Format
The first line contains a positive integer , the number of queries.
Each of the next lines contains a positive integer , where denotes a position in sequence .
Output Format
Output lines, each being or , representing the digit at position in the sequence.
4
3
14
7
6
0
0
1
0
Hint
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号