POJ 1019
来源:互联网 发布:新媒体营销的数据 编辑:程序博客网 时间:2024/05/16 15:20
/* * poj_1019.c * accepted? */#include <stdio.h>#include <math.h> /* pow, log10 */static int poj_1019 (int);int main (int argc, char ** argv){ int i,n; int k,r; scanf ("%d", &n); for (k=0; k<n; k++){ scanf ("%d",&i); r = poj_1019 (i); printf ("%d\n", r); }}unsigned int a[31270];unsigned int s[31270];static int poj_1019 (int n){ int i; int length = 0; int pos; 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]; } for (i=1; s[i]<n; i++){ ; } pos = n - s[i-1]; for (i=1; length < pos; i++){ length += (int)log10((double)i) + 1; } return (i-1)/ (int)pow((double)10, length - pos)%10;/*为什么不是 (i-1)%10 */}
参考:http://www.slyar.com/blog/poj-1019-cpp.html
还没有想清楚return语句的含义
- 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
- 堆排序
- 《MFC游戏开发》笔记二 建立工程、调整窗口
- 02-CMD_常用批处理内部命令2
- <谷歌如何测试>
- progress_timer
- POJ 1019
- some assemble instructions reference
- MyEclipse
- Dropbox创造共享新思维——Datastore API
- 嵌入式linux下u盘升级的设计
- 深度围观block:第一集
- Unity 如何实现控制主角以及碰撞检测
- qt安装遇到的错误
- Jquery Tab框切换