首页 > 代码库 > Fibonacci
Fibonacci
Interesting Fibonacci
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 672 Accepted Submission(s): 116
So you can see how interesting the Fibonacci number is. Now AekdyCoin denote a function G(n) Now your task is quite easy, just help AekdyCoin to calculate the value of G (n) mod C
In mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, ...
By definition, the first two numbers in the Fibonacci sequence are 1 and 1, and each subsequent number is the sum of the previous two. In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation Fn = Fn - 1 + Fn - 2 with seed values F1 = 1 and F2 = 1.
And your task is to find ΣFiK, the sum of the K-th power of the first N terms in the Fibonacci sequence. Because the answer can be very large, you should output the remainder of the answer divided by 1000000009.
Input
There are multiple test cases. The first line of input is an integer T indicates the number of test cases. For each test case:
There are two integers N and K (0 <= N <= 1018, 1 <= K <= 100000).
Output
For each test case, output the remainder of the answer divided by 1000000009.
Sample Input
510 14 2020 29999 99987654321987654321 98765
Sample Output
14348783295274049690113297124108672406
Hint
The first test case, 1 + 1 + 2 + 3 + 5 + 8 + 13 + 21 + 34 + 55 = 143.
The second test case, 120 + 120 + 220 + 320 =3487832979, and 3487832979 = 3 * 1000000009 + 487832952, so the output is 487832952.
Author: ZHOU, Yuchen
25 513 5
03
2014年蓝桥杯的第九题是这样描述的:
给定Fibonacci数列F[],其中,,求表达式
的值。其中
E - 喵喵的遗憾
Problem Description
喵喵因为太弱,没有进Final,终身遗憾。她就挂在了这个题目上。
已知:
F0 = 1 , F1 = 1 , F2 = 2 , Fn = Fn-1+Fn-2
求:
FFFn Mod P
( 也就是 F[ F[ F[n] ] ] % P )
Input
第一行一个整数 T 代表数据组数(T ≤ 20000)。 <del> 喵以人格担保时限肯定够!!!</del>
以下每行两个整数 N , P (0 ≤ N ≤ 109 , 1 ≤ P ≤ 109)
Output
Sample Input
41 22 34 354 31
Sample Output
12343
Hint
F1 = 1 , F1 = 1 , F1 = 1
F2 = 2 , F2 = 2 , F2 = 2
F4 = 5 , F5 = 8 , F8 = 34
3286: Fibonacci矩阵
Time Limit: 15 Sec Memory Limit: 128 MB Submit: 131 Solved: 29 [Submit][Status]Description
Input
八个用空格隔开的整数n, m, a, b, c, d, e, f,其中n, m, a, b, d, e为正整数,c, f为非负整数。
Output
一个整数,表示Fib[n][m]对2012182013取模的值。
Sample Input
Sample Output
HINT
n,m,a,b,c,d,e,f<=10^1000000
Source
tangjz原创
优美的Fibonacci数列与矩阵
题目:http://codeforces.com/contest/392/problem/C
题意:给定Fibonacci数列F[],令,求的值。
广义Fibonacci数列找循环节
今天将来学习如何求广义Fibonacci数列的循环节。
问题:给定,满足,求的循
环节长度。
来源:http://acdreamoj.sinaapp.com/ 1075题
245
620
25 513 5
03
100
F(100)= 3 * 5^2 * 11 * 41 * 101 * 151 * 401 * 3001 * 570601
6ba
3
1021 | Fibonacci Again | Leojay | (17212/35677)48.24% | |
1250 | Hat‘s Fibonacci | 戴帽子的 | (2278/6923)32.90% | |
1568 | Fibonacci | daringQQ | Happy 2007 | (1484/3238)45.83% |
1588 | Gauss Fibonacci | DYGG | HDU “Valentines Day” Open Programming Contest 2007-02-14 | (885/2030)43.60% |
1708 | Fibonacci String | linle | HDU 2007-Spring Programming Contest | (1122/3263)34.39% |
1848 | Fibonacci again and again | lcy | ACM Short Term Exam_2007/12/13 | (1907/4528)42.12% |
2814 | Interesting Fibonacci | AekdyCoin | HDU 1st “Old-Vegetable-Birds Cup” Programming Open Contest | (116/672)17.26% |
2855 | Fibonacci Check-up | 2009 Multi-University Training Contest 5 - Host by NUDT | (626/1120)55.89% | |
3054 | Fibonacci | 2009 Multi-University Training Contest 15 - Host by BUAA | (83/212)39.15% | |
3117 | Fibonacci Numbers | IPCP 2005 Northern Preliminary for Northeast North-America | (676/1709)39.56% | |
3306 | Another kind of Fibonacci | wyb | HDOJ Monthly Contest – 2010.02.06 | (561/1464)38.32% |
3509 | Buge‘s Fibonacci Number Problem | 2010 ACM-ICPC Multi-University Training Contest(8)——Host by ECNU | (179/643)27.84% | |
4099 | Revenge of Fibonacci | 2011 Asia Shanghai Regional Contest | (456/1963)23.23% | |
4786 | Fibonacci Tree | 2013 Asia Chengdu Regional Contest | (308/1043)29.53% |