Files
python/TangDou/KaoShi/病毒繁殖.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
418 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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