Files
python/TangDou/KaoShi/病毒繁殖.cpp

25 lines
418 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}