【poj 1019】Number Sequence
2016-03-31 15:01
567 查看
题目链接:
http://poj.org/problem?id=1019
题意&题解:
/article/1968932.html
公式都没听过,感觉就是理解思路后抄一遍代码,好菜orz
代码:
http://poj.org/problem?id=1019
题意&题解:
/article/1968932.html
公式都没听过,感觉就是理解思路后抄一遍代码,好菜orz
代码:
#include<iostream> #include<algorithm> #include<stdio.h> #include<string.h> #include<math.h> using namespace std; int n,T; unsigned s[31300],a[31300]; int main() { a[1]=1;s[1]=1; for (int i=2;i<=31269;i++) { a[i]=a[i-1]+(int)log10((double)i)+1; s[i]=s[i-1]+a[i]; } scanf("%d",&T); while(T--) { scanf("%d",&n); int tmp=1; while(s[tmp]<n) tmp++; int pos=n-s[tmp-1]; int len=0; int i=1; for (i=1;len<pos;i++) len+=(int)log10((double)i)+1; cout<<(i-1)/(int)pow((double)10,len-pos)%10<<endl; //这些公式都是抄的,并不明白原理,等教练讲吧。。 } }
相关文章推荐
- Java中的String、StringBuffer和StringBuilder区别
- GCD的同步异步串行并行、NSOperation和NSOperationQueue一级用dispatch_once实现单例
- [Form Builder]:CREATE_GROUP Built-in
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
- String.valueOf()的一个坑—“null”
- 对Map类分别按照Key,Value排序,返回值为List对象
- iOS之NSPredicate(正则表达式和UIBarController)
- Vue.js 添加组件
- ios CAShapeLayer和UIBezierPath
- iOS在更改用户头像并保存至本地沙盒目录中对于UIImagePickerController、UIAlertController的使用
- [UITableView _endCellAnimationsWithContext:]
- iOS基本UI控件总结
- #学习笔记#(56)angular ui-router使用姿势
- An AnnotationConfiguration instance is required to use.....异常
- php中的continue用法
- iOS-一个对UIAlertController的封装类分享
- iOS: setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name.
- iOS UITableViewController出现crash
- 从response.header中提取cookie,在request里添加cookie
- 从response.header中提取cookie,在request里添加cookie