斐波那契数列在long long范围内最大可达103
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cctype>
#include <unordered_map>
#include <map>
using namespace std
;
const int N
= 105;
typedef pair
<int, string
> PII
;
typedef long long LL
;
int main() {
int n
;
LL F
[103];
F
[1] = 1, F
[2] = 2;
for(int i
= 3; i
< 90; i
++){
F
[i
] = F
[i
-1] + F
[i
-2];
}
while(cin
>>n
){
cout
<<F
[n
]<<endl
;
}
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-75587.html