Number Sequence
总提交: 6 测试通过: 2
描述
This is simple a number sequence problem. In this problem a positive integer n will repeated n times. And number will start with 1 and continue to infinite. For example: if n is 11 then 11 will repeated 11 times.(11 11 11 11 11 11 11 11 11 11 11). In this problem you are expected to write a program that take a positive number p and display the digit of position p. p| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
d(p)| 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6
输入
The input may contain multiple test cases. Each test case occupies a separate line and contains an integer n (1 ≤ n ≤ 199000000 ). The input terminates by end of file marker.
输出
For each test case in the input output the digit of n position on a separate line.
样例输入
1
11
14
19
21
22
46
47
48
49
样例输出
1
5
5
6
6
7
1
0
1
0
分析:先说下题目大概意思。d(p)| 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 ...... 1 0 1 0
p| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .....46 47 48 49