find the nth digit
S1 = 1
S2 = 12
S3 = 123
S4 =
1234
.........
S9 = 123456789
S10 = 1234567891
S11 =
12345678912
............
S18 =
123456789123456789
..................
现在我们把所有的串连接起来
S =
1121231234.......123456789123456789112345678912.........
那么你能告诉我在S串中的第N个数字是多少吗?
接下来的K行每行有一个整数N(1 <= N <
2^31)。
#include <stdio.h> int main(){
int T;
int number;
int i; scanf("%d",&T); while(T--){
scanf("%d",&number); i=;
while(){
if(number>i){
number-=i;
i++;
} else
break;
} number%=; if(number==)
number=; printf("%d\n",number);
} return ;
}
find the nth digit的更多相关文章
- [LeetCode] Nth Digit 第N位
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n i ...
- Leetcode: Nth Digit
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n i ...
- hdu 1597 find the nth digit
find the nth digit Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- Nth Digit | leetcode
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n i ...
- find the nth digit(二分查找)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1597 find the nth digit Time Limit: 1000/1000 MS (Jav ...
- [Swift]LeetCode400. 第N个数字 | Nth Digit
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is ...
- C++版 - Leetcode 400. Nth Digit解题报告
leetcode 400. Nth Digit 在线提交网址: https://leetcode.com/problems/nth-digit/ Total Accepted: 4356 Total ...
- (lower_bound)find the nth digit hdu1597
find the nth digit Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- LeetCode——Nth Digit
Question Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... ...
- hdu 1597 find the nth digit (数学)
find the nth digit Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
随机推荐
- 第二百零五天 how can I 坚持
身体无论什么时候都是最重要的.肝血管瘤,头一次听说,应该没什么大碍.父母年龄大了,我们也该尽快把自己的事情处理好,让他们放心了. 规律作息,合理饮食,多注意锻炼. 该怎么办.不能这拖下去. 好好规划下 ...
- HDU 2034 人见人爱A-B 分类: ACM 2015-06-23 23:42 9人阅读 评论(0) 收藏
人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- TQImport3XLS.Map
property Map: TStrings; 设置数据集字段和Excel单元格之间定义映射属性以下列方式: FieldName=CellRange 导入单独的单元格 Field1=A1 Field1 ...
- Remove Duplicates from Sorted List @LeetCode
/** * Remove Duplicates from Sorted List * * Given a sorted linked list, delete all duplicates such ...
- halcon的性能
·满足您各类机器视觉应用需求的完善的开发库 ·包含匹配,识别,定位及1D,2D,3D测量等多种高级算法 ·强大,易用的工具加速您的开发进程 ·与Linux/UNI及Windows(包括×64)兼容,避 ...
- mysql中 group_concat长度限制
//这个函数有长度限制,上了多次当.默认长度1024长度. select group_concat(id) from table; 要彻底修改,在MySQL配置文件(my.ini)中加上 group_ ...
- 后台动态设置前台标签内容和属性(转自http://www.wzsky.net/html/Program/net/26171.html)
和以前的asp不同,在asp.net中为了彻底的代码分离,我们一般不采用<%=%>嵌入标签中来设置一些属性和内容.一般来说有2种情况:(一)设置标签的内容,比如<title>这 ...
- PowerDesigner 业务处理模型( BPM ) 说明 及Enterprise Architect使用教程
http://www.cnblogs.com/springside-example/archive/2011/10/17/2529640.html http://wenku.baidu.com/lin ...
- VTK序列图像的读取[转][改]
医学图像处理的应用程序中,经常会碰到读取一个序列图像的操作.比如CT.MR等所成的图像都是一个切面一个切面地存储的,医学图像处理程序要处理这些数据,第一步当然是把这些数据从磁盘等外部存储介质中导入内存 ...
- oracle 创建同义词
1.语法: 同义词 (SYNONMY) CREATE SYNONYM同义词名FOR 表名; CREATE SYNONYM同义词名FOR 表名@数据库链接名; Create synonym synony ...