HDU 1201 Fibonacci Again】的更多相关文章

Fibonacci Again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37229    Accepted Submission(s): 17970 Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n)…
HDU 3117 Fibonacci Numbers(斐波那契前后四位,打表+取对+矩阵高速幂) ACM 题目地址:HDU 3117 Fibonacci Numbers 题意:  求第n个斐波那契数的前四位和后四位.  不足8位直接输出. 分析:  前四位有另外一题HDU 1568,用取对的方法来做的.  后四位能够用矩阵高速幂,MOD设成10000即可了. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: http://blog.c…
斐波那契数列后四位可以用快速幂取模(模10000)算出.前四位要用公式推 HDU 3117 Fibonacci Numbers(矩阵快速幂+公式) f(n)=(((1+√5)/2)^n+((1-√5)/2)^n)/√5 假设F[n]可以表示成 t * 10^k(t是一个小数),那么对于F[n]取对数log10,答案就为log10 t + K,此时很明显log10 t<1,于是我们去除整数部分,就得到了log10 t 再用pow(10,log10 t)我们就还原回了t.将t×1000就得到了F[n…
Interesting Fibonacci Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 665    Accepted Submission(s): 114 Problem Description In mathematics, the Fibonacci numbers are a sequence of numbers named…
这道题其实也是水题来的,求Fibonacci数的前4位和后4位,在n==40这里分界开.后4位不难求,因为n达到了10^18的规模,所以只能用矩阵快速幂来求了,但在输出后4位的时候一定要注意前导0的处理(我就是在这里wa了一发,也是看了看别人的代码才发现的). 前4位的话稍微有点难处理,我一开始就在想该怎么处理 log10(f(n)) 呢?把f[n]= f[n-1]+f[n-2]? 不行,log对+运算没法展开,我找了好久也没能找到什么能让f[n]展开成相乘或者幂的形式,上网搜了下题解,才发现别…
http://acm.hdu.edu.cn/showproblem.php?pid=4786 Fibonacci Tree Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 49    Accepted Submission(s): 26 Problem Description Coach Pang is interested in Fi…
http://acm.hdu.edu.cn/showproblem.php?pid=1021 Fibonacci Again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29201    Accepted Submission(s): 14148 Problem Description There are another kind…
Fibonacci Tree 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=4786 Description Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Consi…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1021 Fibonacci Again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 70782    Accepted Submission(s): 32417 Problem Description There are another ki…
Fibonacci again and again HDU - 1848 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1,2,3,5,8,13……就是菲波那契数列. 在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题. 今天,又一个关于Fibonacci的题目出现了,它是一个小游戏,定义如下: 1.  这是一…