'commit'
This commit is contained in:
25
TangDou/KaoShi/病毒繁殖.cpp
Normal file
25
TangDou/KaoShi/病毒繁殖.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user