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.

25 lines
418 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
/*
10
10
1 1 1 1 2 3 4 5 7 10
*/
const int N = 110;
int a[N] = {0, 1, 1, 1, 1};
int main() {
int n;
cin >> n;
for (int i = 5; i <= n; i++)
a[i] = a[i - 1] + a[i - 4];
// for (int i = 1; i <= n; i++) printf("%d ", a[i]);
// puts("");
printf("%d\n", a[n]);
return 0;
}