///@link http://acm.hdu.edu.cn/showproblem.php?pid=2057///@author Sycamore///@date Aug 17#includeusing namespace std;int main(){ ios::sync_with_stdio(... ...
分类:
其他好文 时间:
2017-08-17 13:06:48
阅读次数:
205
斐波那契查找是一种在有序表中高效查找指定元素的算法,比折半查找要复杂一些,主要复杂在要多做不少准备工作。下面看它的工作流程: 1.计算并保存一个斐波那契序列的数组,方便以后取值。数组名记为f,例如f[1]=1,f[2]=1,f[3]=2,f[4]=3,f[5]=5,f[6]=8,f[7]=13,f[ ...
分类:
编程语言 时间:
2017-08-15 12:35:44
阅读次数:
223
题解:所有计算都是对n取模的,不妨设F(i) = f(i) mod n。不难发现,当二元组(F(i),F(i+1))出现重复时,整个序列就开始重复。因为余数最多 n种,所以最多n2 项就会出现重复。设周期为M,则只需要计算出F[0]~F[n2],然后算出F[ab]等于其中哪一项就可以了。 摘自《算法 ...
分类:
其他好文 时间:
2017-08-15 10:11:49
阅读次数:
127
It is not the mountain we conquer but outselves. 我们要征服的不是高山,而是我们自己。 After days of hard working, I sliding into the idling state again. Looking at the ...
分类:
其他好文 时间:
2017-08-14 00:37:43
阅读次数:
120
学习java高级编程,新建了一个工程,报名取为java,结果运行代码后出现如下错误; 重新命名package就好了。 ...
分类:
其他好文 时间:
2017-08-13 16:17:00
阅读次数:
3689
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3306 题目意思:一个斐波那契数列的变式,本来是A[n]=A[n-1]+A[n-2],现在变成A[n]=N*A[n-1]+Y*A[n-2]。一个很简单的矩阵快速幂。 S(N) = A(0)2 +A(1)2 ...
分类:
其他好文 时间:
2017-08-13 10:11:04
阅读次数:
164
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2855 题目意思:求一个式子g[n]=∑C(n,k)*f[k],n很大,很明显是一个矩阵快速幂。可以打表发现g[n]=f[2*n]划开可以发现g[n]=3*g[n-1]-f[n-2]。 思路:我们现在可以 ...
分类:
其他好文 时间:
2017-08-13 10:06:41
阅读次数:
155
Chinese remainder theorem again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3174 Accepted Su ...
分类:
其他好文 时间:
2017-08-12 22:31:36
阅读次数:
174
Previews of media files are disabled by default in Windows Server 2008. In this article we will enable it so we get the small previews back again! 1. ... ...
题目描述 ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. As a s ...
分类:
其他好文 时间:
2017-08-11 22:58:19
阅读次数:
142