CSES Problemset/Introductory Problems
Digit Queries
#2431Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopConsider an infinite string that consists of all positive integers in increasing order:
12345678910111213141516171819202122232425...
Your task is to process queries of the form: what is the digit at position in the string?
Input
The first input line has an integer : the number of queries.
After this, there are lines that describe the queries. Each line has an integer : a -indexed position in the string.
Output
For each query, print the corresponding digit.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
3 7 19 12
Expected Output
7 4 1
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
3 7 19 12
Expected Output
7 4 1