N很大情况下的Fibonacci前四位-HDU1568(重要)
2017-07-16 17:45
471 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1568
参考博客:http://www.cnblogs.com/Yu2012/archive/2011/10/09/2199156.html (很重要)
http://blog.csdn.net/lvshubao1314/article/details/38013897
参考博客:http://www.cnblogs.com/Yu2012/archive/2011/10/09/2199156.html (很重要)
http://blog.csdn.net/lvshubao1314/article/details/38013897
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int mod=10000; int a[25]={0,1,1}; int main() { for(int i=3;i<=20;i++) a[i]=a[i-1]+a[i-2]; int s; while(~scanf("%d",&s)) { if(s<=20) cout<<a[s]<<endl; else{ double f=(1.0+sqrt(5.0))/2.0; double m=(-0.5)*log(5)/log(10)+s*log(f)/log(10); m=m-floor(m); double q=pow(10,m); while(q<1000) { q=q*10; } cout<<(int)q<<endl; } } return 0; }
相关文章推荐
- (Relax 矩阵快速幂1.1)POJ 3070 Fibonacci(求第n个斐波那契数的后四位。n很大)
- zabbix自定义key监控mysql重要参数的运行情况
- Fibonacci Numbers hoj 求斐波那契前四位和后四位
- HDU1568_求fibonacci的前四位
- HDU1568-大数的Fibonacci(取对数技巧,通项公式)
- Fibonacci(hdu1568)——一道我不知道怎么说的题
- nontrivial default constructor(重要的默认构造函数)---四种情况
- 求最大公约数。考虑两个正整数都很大的情况。
- 【类似N^N做法的斐波那契数列】【HDU1568】 Fibonacci
- 【Fibonacci 数列前四位&后四位】hdu 3117
- 推荐一个优化分页查询的办法(分页数很大的情况)
- Fibonacci性质 hdu1568
- hdu1568-Fibonacci
- 重要:mongodb在网络环境不太好的情况下,在应用层会直接丢数据
- 【类似N^N做法的斐波那契数列】【HDU1568】 Fibonacci
- cocos2d-x 3.0rc2 对于每个包执行情况的重要平台 (超级方便)
- hdu1568-Fibonacci
- 30 秒裁剪的很大一部分作用是观察什么对别人是重要的
- 推荐一个优化分页查询的办法(分页数很大的情况)
- Eclipse重要快捷键汇总(不是一次性补全,根据日常使用情况逐步完善)