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.
|
|
|
|
#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个月
|
|
|
|
|
}
|