W - 大菲波数
Fibonacci数列,定义如下:
f(1)=f(2)=1
f(n)=f(n-1)+f(n-2) n>=3。
计算第n项Fibonacci数值。
Input
输入第一行为一个整数N,接下来N行为整数Pi(1<=Pi<=1000)。
Output
输出为N行,每行为对应的f(Pi)。
Sample Input
5
1
2
3
4
5
Sample Output
1
1
2
3
5
数据量大,unsigned long long 也存不下,所以写个大整数,这里要特别注意的是大整数算完结果是逆序的,要把它逆转回来。
#include<iostream>
#include<cstring>
#include<cstdlib>
#define maxn 1010
using namespace std;
char f[maxn][maxn];
void add(char