题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1568参考别人的思路过的==|||,当n比较大的时候,使用如图所示的通项公式:先化简,使用极限考虑,n很大的情况消去一个项:[1-(1-?5)^n/(1+?5)^n],然后方程两边取对数。得到log10(...
                            
                            
                                分类:
其他好文   时间:
2015-06-03 15:24:04   
                                阅读次数:
105
                             
                    
                        
                            
                            
                                现在换是看不明白SG函数的求法什么的
暂时先当模板题吧
函数mex1就是求g(x)
然后异或
#include
#include
#include
#include
using namespace std;
int k,fibo[100],f[10001];
int mex1(int p){
    int i,t;
    bool g[101]={0};
    for(i=0;i<k...
                            
                            
                                分类:
其他好文   时间:
2015-06-02 23:34:00   
                                阅读次数:
415
                             
                    
                        
                            
                            
                                题目大意: 
F函数是fibonacci函数,F(0) = 0,F(1) = 1解题思路:这题我也不会推,打表可以得到结论。。。 
G(n) = 3 * G(n-1) - G(n-2),G函数表示 
这题要注意最后求得的可能是负数,所以最后要处理一下#include
typedef long long ll;
const int N = 2;
struct Matrix {...
                            
                            
                                分类:
其他好文   时间:
2015-06-02 09:31:39   
                                阅读次数:
169
                             
                    
                        
                            
                            
                                题目大意:fibonacci的升级版,规则是f(n) = f(n-1) + f(n-2) + f(n-3)解题思路:水题#include
typedef long long ll;
const int N = 3;
const ll mod = 1e9 + 9;struct Matrix{
    ll mat[N][N];
}A, B, tmp;
ll n;void init(){...
                            
                            
                                分类:
其他好文   时间:
2015-06-02 09:31:17   
                                阅读次数:
127
                             
                    
                        
                            
                            
                                题目大意:要求输出第n个fibonacci数,如果该数超过1e9,就输出该数的前4位和后四位解题思路:通过打表可得,第40个fibonacci数是大于1e9的,所以40之前的可以直接计算 
40之后的比较麻烦,参考了别人的题解 
http://blog.sina.com.cn/s/blog_9bf748f301019q3t.html#include
#include
u...
                            
                            
                                分类:
其他好文   时间:
2015-06-02 09:22:16   
                                阅读次数:
108
                             
                    
                        
                            
                            
                                The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn?1 + Fn?2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 1...
                            
                            
                                分类:
其他好文   时间:
2015-06-02 00:33:24   
                                阅读次数:
168
                             
                    
                        
                            
                            
                                题目:一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶,求该青蛙跳上一个n级台阶总共有多少中跳法。思路:问题本质上是fibonacci问题。class Solution {public:	int jumpFloor(int number) { int jumpNumber=0;//青蛙跳台阶跳法 ....
                            
                            
                                分类:
其他好文   时间:
2015-06-01 18:08:50   
                                阅读次数:
139
                             
                    
                        
                            
                            
                                题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2855题目大意:求$S(n)=\sum_{k=0}^{n}C_{n}^{k}Fibonacci(k)$解题思路:题目挺吓人的。先把完整组合数+Fibonacci展开来。利用Fibonacci的特性,从第一...
                            
                            
                                分类:
其他好文   时间:
2015-06-01 12:57:31   
                                阅读次数:
119
                             
                    
                        
                            
                            
                                //循环方式实现#include int main(int argc, char *argv[]){ int f1=0,f2=1,f3; printf("%d ",f1); printf("%d ",f2); while(f1int fibo(int n){ if(...
                            
                            
                                分类:
其他好文   时间:
2015-05-30 13:25:56   
                                阅读次数:
92
                             
                    
                        
                            
                            
                                无穷数列1,1,2,3,5,8,13,21,34,55...称为Fibonacci数列,它可以递归地定义为F(n)=1 ...........(n=1或n=2)F(n)=F(n-1)+F(n-2).....(n>2)现要你来求第n个斐波纳奇数。(第1个、第二个都为1);输入第一行是一个整数m(mlo...
                            
                            
                                分类:
其他好文   时间:
2015-05-29 11:39:35   
                                阅读次数:
136