23 条题解
-
-6
#include <iostream> #include <stack> #include <cmath> #include <vector> #include <string.h> #include <queue> #include <stdio.h> #include <iomanip> #include <cstdio> #include <algorithm> #define int long long using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; /*int f(int x) { if(x == 1 || x == 2) { return 1; } return f(x - 1) + f(x - 2); } signed main() { int n; cin >> n; cout << f(n) << endl; }*/ int n; signed main() { cin >> n; int a, b, c; a = b = c = 1; for(int i = 3; i <= n; i++) { c = a + b; a = b; b = c; } cout << c << endl; }
数据可能有一点点大
信息
- ID
- 904
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 949
- 已通过
- 419
- 上传者