poj 1019
来源:互联网 发布:云计算 中国 编辑:程序博客网 时间:2024/06/05 16:34
代码如下
#include<math.h>#include<iostream>#include<cstdio>using namespace std;unsigned int a[31270],s[31270];void reset()//打表{ int i; a[1]=1; s[1]=1; for(i=2;i<31270;i++) { a[i]=a[i-1]+(int)log10((double)i)+1; s[i]=s[i-1]+a[i]; } } int main(){ int T; int n; int i; scanf("%d",&T); reset(); while(T--) { scanf("%d",&n); i=1; while(s[i]<n) i++; int pos=n-s[i-1]; int tmp=0; for(i=1;tmp<pos;i++) { tmp+=(int)log10((double)i)+1; } int k=tmp-pos; printf("%d\n",(i-1)/(int)pow(10.0,k)%10) ;/*从右向左求,比如123456,k=2,则结果为4*/ } return 0; }
阅读全文
0 0
- poj 1019
- POJ-1019
- POJ 1019
- POJ 1019
- POJ 1019
- poj 1019
- POJ 1019
- poj 1019
- POJ 1019
- poj 1019
- poj-1019
- poj 1019
- poj 1019
- poj-1019
- poj 1019
- POJ 1019 Number Sequence
- POJ 1019 Number Sequence
- poj 1019 Number Sequence
- 对于查询调优,你需要的不止STATISTICS IO
- 星小环的AI读书会—深度学习系列01开篇
- C++智能指针详解
- Android弹出Window提示框(基于Android6.0)
- 2014年计算机联考真题——带权路径长度之和
- poj 1019
- java大数算法完成五则运算之类基础
- java 实现leetcode Two Sum II
- Eclipse插件springsource-tool-suite的下载和安装
- FFMPEG的AVFormatContext、AVStream、AVPacket、AVFrame时间戳分析
- 链表
- CentOS 6.5 升级内核到 3.10.28
- Spring-AOP @AspectJ切点函数之@annotation()
- LINUX TensorFlow 相关积累