题目链接
题意:给出n和m,求出f(n) % m, f(x)为斐波那契数列。
思路:因为n挺大的,如果直接利用公式计算很有可能会TLE,所以利用矩阵快速幂求解,|(1, 1), (1, 0)| * |f(n - 1), f(n - 2)| = |f(n), f(n - 1)|,所以求f(n)相当于|f(1), f(0)|乘上n - 1次的|(1, 1), (1, 0)|。
...
分类:
其他好文 时间:
2014-08-28 16:57:40
阅读次数:
187
FinonacciT(N) = T(N-1) + T(N-2);>= 2T(N-2) = O(2^(N/2))Memorized Dp algorithm//1,1,2,3,5,8.....Memo = {}fib(n): if n in memo, return memo{n} if n<...
分类:
其他好文 时间:
2014-08-28 04:16:28
阅读次数:
183
How many Fibs?DescriptionRecall the definition of the Fibonacci numbers:f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n>=3) Given two numbers a and b, calcul...
分类:
其他好文 时间:
2014-08-27 20:17:48
阅读次数:
208
因为OpenMIPS设计乘累加、乘累减、除法指令在流水线执行阶段占用多个时钟周期,因此需要暂停流水线,以等待这些多周期指令执行完毕,一种直观的实现方法是:要暂停流水线,只需保持取指令地址PC的值不变,同时保持流水线各个阶段的寄存器(也就是IF/ID、ID/EX、EX/MEM、MEM/WB模块的输出)不变。
OpenMIPS采用的是一种改进的方法:假如位于流水线第n阶段的指令需要多个时钟周期,进而请求流水线暂停,那么需保持取指令地址PC的值不变,同时保持流水线第n阶段、第n阶段之前的各个阶段的寄存器不变,而第...
分类:
其他好文 时间:
2014-08-27 00:26:36
阅读次数:
333
#include<iostream>
usingnamespacestd;
intmain()
{
intpound,p0,p1,days,result;
charans;
do
{
cout<<"Pleaseinputthepoundandthedays:\n";
cin>>pound>>days;
intn=days/5;
if(0==n||1==n)
{
result=pound;
cout<<"Theresultis"<<..
分类:
其他好文 时间:
2014-08-26 03:12:26
阅读次数:
204
我本机装的是64位Ubuntu, SDK 里提供的 buildroot-gcc342 是32位的,无法直接运行,需要先安装 gcc-multilib.sudo apt-get install gcc-multilib之前一直做 ARM 开发, 对这里 MIPS 首先要了解一点它的 MMU 内存映射关...
分类:
其他好文 时间:
2014-08-25 18:36:04
阅读次数:
502
Fibonacci again and again
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5093 Accepted Submission(s): 2127
Problem Description
任何一个...
分类:
其他好文 时间:
2014-08-24 23:55:23
阅读次数:
241
1 首先加载项目2 进入项目的根目录,输入ndk-build命令3 如果成功,就会发现项目的libs的mips文件夹下有libplasma.so文件4 然后运行程序,成功
分类:
其他好文 时间:
2014-08-24 19:19:13
阅读次数:
266
Fibonacci again and againTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5088Accepted Submission(s...
分类:
其他好文 时间:
2014-08-23 09:58:00
阅读次数:
202
大菲波数Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11520 Accepted Submission(s): 3911Problem ...
分类:
编程语言 时间:
2014-08-22 22:28:59
阅读次数:
236