find the nth digit

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9821    Accepted Submission(s): 2879

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:  1372 1548 1595 1240 1239 

简单数学题,高斯求和公式秒解:

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
__int64 i,j,k,l,m,n,t;
int main()
{scanf("%I64d",&k);while(k--){scanf("%I64d",&n);for(i=1;;i++)if(i*(i+1)/2>=n)break;m=n-i*(i-1)/2;m%=9;if(m==0)m=9;printf("%I64d\n",m);}
}

杭电1597 find the nth digit相关推荐

  1. hdu 1597 find the nth digit(等差求和+二分)

    find the nth digit Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  2. 【HDOJ】1597 find the nth digit

    二分. 1 #include <stdio.h> 2 #include <math.h> 3 4 int main() { 5 int case_n; 6 double n, ...

  3. HDU 1597 find the nth digit (二分查找)

    二分查找 1 #include<stdio.h> 2 __int64 a[65555]; 3 void init() 4 { 5 a[0]=0; 6 for(int i=1;i<65 ...

  4. HDU - 1597 find the nth digit 【找规律】

    Description 假设: S1 = 1 S2 = 12 S3 = 123 S4 = 1234 ......... S9 = 123456789 S10 = 1234567891 S11 = 12 ...

  5. 杭电OJ分类题目(2)

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(2) HDU Water~~~ HDU 100 ...

  6. hdoj杭电问题分类

    杭电上的题虽然多,但是一直苦于找不到问题分类,网页都是英文的,所以平时做题也没怎么看,今天仔细一看,问题分类竟然就在主页....做了那么久的题居然没发现,表示已经狗带..不要笑,不知道有没有像我一样傻 ...

  7. 杭电acm2151题java的解法,杭电ACM题型分类

    杭电ACM题型分类 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.1048.1 ...

  8. 杭电OJ分类题目(3)

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(3) HDU Computational Ge ...

  9. 杭电OJ分类题目(1)

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(1) HDU Introduction HDU ...

最新文章

  1. pandas使用isna函数和any函数计算返回dataframe中包含缺失值的数据行(rows with missing values in dataframe)
  2. 轨道半径对氦原子基态能级的影响He
  3. 64位传参利用方法LibcSearcher使用入门ROPgadget利用
  4. pep8 python 编码规范_「原创」「python自学笔记」python编码规范
  5. 一年赚上亿的生意_如何一年不到的时间2万赚10个亿?
  6. 美图秀秀首页界面按钮设计(二)
  7. 修改数据包欺骗服务器,Fiddler协议捕获编辑工具与Session欺骗原理详解
  8. android 绘画笔迹回放_随时记录分享书写笔迹,EverPEN高级版套装体验
  9. 2013第39周一Web打印
  10. 注册终止处理函数atexit()
  11. mysql 取模分区_MySQL分区
  12. css设置按钮竖直方向居中_button内flex垂直居中竟然不居中的解决
  13. ubuntu hadoop安装教程
  14. 在手机上共享屏幕,更专业的远程协助软件
  15. c# [NETSDK1005] havent a target “net48“
  16. 计算机微信接收excel打不开怎么回事,电脑端微信打不开怎么解决
  17. linux格式化硬盘 中断,linux格式化硬盘【调解方案】
  18. 【python 新浪微博爬虫】python 爬取新浪微博热门话题
  19. 数据控制—完整性约束
  20. 卡内基梅隆大学计算机方向,留学美国卡内基梅隆大学计算机硕士研究方向

热门文章

  1. 【须弥SUMERU】宜信分布式安全服务编排实践
  2. 使用Java访问Mysql数据库时出现时区异常的解决方案
  3. Spring Cloud 架构 五大神兽的功能
  4. 11、web端主要应用在哪些领域?
  5. How can I set ccshared=-fPIC while executing ./configure?
  6. 创建 JavaScript 对象
  7. SDL2.0文档翻译
  8. Windows 7常用快捷键一览表
  9. 理解Asp.Net自定义控件的生命周期
  10. 用vim替代source insight