7 solutions
-
0
不开long long 见祖宗,该题可能接近70的时候会越界
#include<iostream> #include<cmath> using namespace std; using ll = long long; const int N = 75; ll f[N]; int main() { int n;cin>>n; f[1] = 1; f[2] = 2; for(int i = 3;i <= n;i++) { f[i] = f[i-1] + f[i-2]; } cout<<f[n]<<"\n"; return 0; }
Information
- ID
- 49
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 604
- Accepted
- 151
- Uploaded By