This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

22
TangDou/XiTi/1260.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int x, y, z;
int a[55];//成虫数量数组
int b[55];//幼儿数量数组
int main() {
scanf("%d%d%d", &x, &y, &z);
//从1月到x月
for (int i = 1; i <= x; ++i)
a[i] = 1, b[i] = 0; //第一个x月的成虫数量
//从第x+1月开始有了变化,出生了第一个y对卵
for (int i = x + 1; i <= z + 1; ++i) {
b[i] = y * a[i - x]; //在i月的幼虫只与i-z月前的成虫有关
a[i] = a[i - 1] + b[i - 2]; //第i个月的成虫只与i-1的成虫和i-2的幼虫有关。
}
printf("%d\n", a[z + 1]);//过了z个月
}