HDOJ 题目1597 find the nth digit(数学)
2014-11-01 00:55
274 查看
find the nth digit
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8518 Accepted Submission(s): 2421
Problem Description
假设:
S1 = 1
S2 = 12
S3 = 123
S4 = 1234
.........
S9 = 123456789
S10 = 1234567891
S11 = 12345678912
............
S18 = 123456789123456789
..................
现在我们把所有的串连接起来
S = 1121231234.......123456789123456789112345678912.........
那么你能告诉我在S串中的第N个数字是多少吗?
Input
输入首先是一个数字K,代表有K次询问。
接下来的K行每行有一个整数N(1 <= N < 2^31)。
Output
对于每个N,输出S中第N个对应的数字.
Sample Input
6
1
2
3
4
5
10
Sample Output
1
1
2
1
2
4
Author
8600
Source
HDU 2007-Spring Programming Contest - Warm
Up (1)
Recommend
8600 | We have carefully selected several similar problems for you: 1312 1372 1596 1595 1240
ac代码
#include<stdio.h> #include<string.h> int main() { int n; while(scanf("%d",&n)!=EOF) { while(n--) { int num,i; scanf("%d",&num); for(i=1;i<num;i++) num-=i; num%=9; if(num) printf("%d\n",num); else printf("9\n"); } } }
相关文章推荐
- hdu 1597 find the nth digit(数学题)
- HDOJ1597 find the nth digit(二分)
- hdu 1597 find the nth digit (数学)
- HDU 1597 find the nth digit (数学题)
- hdoj-1597-find the nth digit
- HDOJ 1597 find the nth digit
- HOJ 1597 find the nth digit(贪心)
- poj 1019 Number Sequence && hdu 1597 find the nth digit(二分,模拟)
- HDU 1597 find the nth digit (二分查找)
- HDOJ&nbsp;&nbsp;1597&nbsp;&nbsp;&nbsp;&nbsp;find&nbsp;the&nbsp;nth&nbsp;digit
- HDU 1597 find the nth digit 水题
- hdu 1597 find the nth digit(等差求和+二分)
- HDU 1597 find the nth digit(规律)
- hdu 1597 find the nth digit
- HDU-1597-find the nth digit(二分+思维)
- HDU 1597 find the nth digit 找规律
- hdu 1597 数学题 find the nth digit
- hdu 1597 find the nth digit(模拟)
- 【HDOJ】1597 find the nth digit
- POJ 1597 find the nth digit (找规律)