public class Fibonacci { private static Map map =
new HashMap(); static{ map.put(0L, 1L); map.put(1L, 1L); } public static void
main(String[] arg...
分类:
其他好文 时间:
2014-06-03 07:24:25
阅读次数:
221
一道找循环节的题,RE了很多发。要用到一个转换式子:a^b%c=[(a%c)^(b%phi(c)+phi(c))]%c#include#include#include#include#include#define
ull unsigned long longusing namespace std;i...
分类:
其他好文 时间:
2014-05-30 02:53:25
阅读次数:
251
话不多说,拿来主义,直接上代码!PS:打印最短路径我还不晓得怎么加,如有哪位大神知道,还请mark一下! 1
/*********************************************************************** 2 *
File: Fibonacci...
分类:
其他好文 时间:
2014-05-26 20:10:56
阅读次数:
568
问题描述Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。当n比较大时,Fn也非常大,现在我们想知道,Fn除以10007的余数是多少。输入格式输入包含一个整数n。输出格式输出一行,包含一个整数,表示Fn除以10007的余数。说明:在本题中,答案是要求Fn除以10007...
分类:
其他好文 时间:
2014-05-26 00:54:58
阅读次数:
265
哎,本来是想学学矩阵构造的方法的,,突然发现自己不用看直接就会yy构造。。。
看下右边有什么。。
题目地址:Another kind of Fibonacci
AC代码:
#include
#include
#include
#include
using namespace std;
const int mod=10007;
int p[4][4],a[4][4],tmp...
分类:
其他好文 时间:
2014-05-25 18:23:49
阅读次数:
268
题目:
已知m、n为整数,且满足下列两个条件:
① m、n∈1,2,...,K,(1≤K≤10^9)
② (n^ 2-mn-m^2)^2=1
编一程序,对给定K,求一组满足上述两个条件的m、n,并且使m^2+n^2的值最大。例如,若K=1995,则m=987,n=1597,则m、n满足条件,且可使m^2+n^2的值最大。...
分类:
其他好文 时间:
2014-05-23 00:21:02
阅读次数:
402
题目大意:
描述了另外一种斐波那契
F[n] = x*F[n-1] + y*F[n-2];
求segma(F[i]^2);
思路分析:
构造矩阵的详细
请戳我
构造矩阵可以得到
中间矩阵为
1 1 0
0
0 x^2 y^2 2*x*y
0 1
0 0
0 x
0 y
#include
#include
#include
#...
分类:
其他好文 时间:
2014-05-22 23:43:19
阅读次数:
318
Problem 2: Even Fibonacci numbers
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2,...
分类:
其他好文 时间:
2014-05-22 23:29:44
阅读次数:
435
上得厅堂,下得厨房,写得代码,翻得围墙,欢迎来到睿不可挡的每日一小练!...
分类:
其他好文 时间:
2014-05-21 14:04:43
阅读次数:
276