You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python/TangDou/AcWing/DP/GunDongShuZhu_ShangTaiJie_1...

24 lines
351 B

#include <bits/stdc++.h>
using namespace std;
//用例:
/*
20
输出:
10946
*/
const int N = 110;
int f[N];
int n;
int solve() {
f[0] = 1, f[1] = 2;
for (int i = 2; i < n; i++)
f[i] = f[i - 1] + f[i - 2];
return f[n - 1];
}
int main() {
scanf("%d", &n);
printf("%d\n", solve());
return 0;
}