Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total Submission (s): 9518 Accepted Submission (s): 2758
Problem description hypothesis:
S1 = 1
S2 = 12
S3 = 123
S4 = 1234
.........
S9 = 123456789
S10 = 1234567891
S11 = 12345678912
............
S18 = 123456789123456789
..................
Now we're going to connect all the strings together.
S = 1121231234.......123456789123456789112345678912 .....
So can you tell me what the nth number is in the s string?
Input inputs are first a number k and represent a K-inquiry.
The next K line has an integer n (1 <= n < 2^31) per line.
Output for each n, the number of the nth corresponding to the outputs S.
Sample Input
61234510
Sample Output
112124
is a rule-finding problem:
#include <stdio.h>int main () {int n,m;scanf ("%d", &n), while (n--) {scanf ("%d", &m); int K=1;while (m>k) { m-=k;k++;} if (m%9==0) {printf ("9\n");} else printf ("%d\n", m%9);} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Find the nth digit