/** 题目:Colossal Fibonacci Numbers! UVA 11582 链接:https://vjudge.net/problem/UVA-11582 题意:f[0] = 1, f[1] = 1; 给定一个n,求f[a^b]%n的结果.a,b达到2^64 - 1大. 思路:a,b很大,用无符号长整型;我还是太菜了,自己没想出来.这道题很显然是找循环节的题.但我不知怎么找. lrj P316 思路就是,由于fibonacci数是由前两个数相加得来,又%n;所以所有fibonacc…
Problem Description The i’th Fibonacci number f(i) is recursively defined in the following way: •f(0) = 0 and f(1) = 1 •f(i + 2) = f(i + 1) + f(i) for every i ≥ 0 Your task is to compute some values of this sequence Input Input begins with an integer…
Colossal Fibonacci Numbers 想先说下最近的状态吧,已经考完试了,这个暑假也应该是最后刷题的暑假了,打完今年acm就应该会退了,但是还什么都不会呢? +_+ 所以这个暑假,一定要竭尽全力地去刷题,当然,也是能好好刷题的最后时间了. [题目链接]Colossal Fibonacci Numbers [题目类型]数学 &题意: 求Fi(f(a^b)%n) Fi()是斐波那契 &题解: 注意:unsigned时 要把%d全换成%u 数学大法好. 首先你要能看出来这是有循环…
思路是按紫书上说的来. 参考了:https://blog.csdn.net/qwsin/article/details/51834161  的代码: #include <cstdio> #include <iostream> #include <cmath> using namespace std; typedef unsigned long long ll; +; ll a, b; int n,M; int f[MAXN*MAXN]; int pow_mod(ll p…
这是个开心的题目,因为既可以自己翻译,代码又好写ヾ(๑╹◡╹)ノ" The i’th Fibonacci number f(i) is recursively defined in the following way: • f(0) = 0 and f(1) = 1 • f(i + 2) = f(i + 1) + f(i) for every i ≥ 0 Your task is to compute some values of this sequence. Input Input begins…
评测地址:http://acm.hust.edu.cn/vjudge/problem/41990 The i'th Fibonacci number f (i) is recursively de ned in the following way: f () = and f () = f (i + ) = f (i + ) + f (i) Your task is to compute some values of this sequence. Input Input begins with a…
题目链接:Uva 11582 [vjudge] watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""> 题意 输入两个非负整数a.b和正整数n(0<=a,b<=2^64,1<=n<=1000),让你计算f(a^b)对n取模的值,当中f(0) = 0,f…
主题链接: pid=1005">huangjing 题意: 就是给了一个公式,然后求出第n项是多少... 思路: 题目中n的范围实在是太大,所以肯定直接递推肯定会超时,所以想到的是暴力打表,找循环节,可是也不是那么easy发现啊,所以这时候分析一下,由于最后都会mod7,所以总共同拥有7X7总情况,即A 0,1,2,3,4,5,6,7.B也是如此,所以循环节为49,这么这个问题就攻克了. .. 题目: Number Sequence Time Limit: 2000/1000 MS (Ja…
https://vjudge.net/problem/UVA-11582 首先明确,斐波那契数列在模c的前提下是有循环节的.而f[i] = f[i-1]+f[i-2](i>=2)所以只要有两个连续的值和开头的一样,后面就开始循环,两两组合共有c*c种. 找到循环节之后 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2802 f[1] = 1; f[2] = 7; f[n] = (f[n-2] - (n-1)*(n-1)*(n-1)+ n*n*n) % 2009, n>2; 给你一个n让你输出f[n];(n<1e9)由于n较大,所以不能直接输出,结果是对2009求余所以一定存在循环节,由于 f(n) 只与 f(n-2) 和 n 有关, 所以我们只需判断 G[n][f[n-2]] 第一次出现和第二次出现的次数即可,…