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.
|
#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;
|
|
} |