昆虫繁殖
来源:互联网 发布:明朝的科技成就 知乎 编辑:程序博客网 时间:2024/06/08 14:26
Problem Description
科学家在热带森林中发现了一种特殊的昆虫,这种昆虫的繁殖能力很强。每对成虫过x个月产y对卵,每对卵要过两个月长成成虫。假设每个成虫不死,第一个月只有一对成虫,且卵长成成虫后的第一个月不产卵(过x个月产卵),问过了z个月以后,共有成虫多少对?0<=x<=20,1<=y<=20,x<=z<=50。
Input
输入有多组数据,每组数据为x、y、z的数值。
Output
对于每组数据输出过了z个月后共有成虫对数。
Sample Input
1 2 8
Sample Output
37
#include<cstdio>int main()//切记注意范围{__int64 f[55],s[55];__int64 x,y,z,i;while(scanf("%I64d %I64d %I64d",&x,&y,&z)!=EOF){for(i=0;i<=x;i++){ f[i]=1; //成虫数量 s[i]=0; //卵的数量}for(i=x+1;i<=z+1;i++){s[i]=f[i-x]*y; //卵的数量等于i-x个月时成虫的数量产的卵f[i]=f[i-1]+s[i-2];//成虫的数量等于i-1个月的成虫数量加上i-2个月的卵的数量}printf("%I64d\n",f[z+1]);}return 0;}
0 0
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- 昆虫繁殖
- codeVS 3914昆虫繁殖
- [codevs3914] 昆虫繁殖
- 练习赛5.昆虫繁殖
- POJ 珍惜昆虫的繁殖问题
- Codves3914 昆虫繁殖 递推 fib变形
- 昆虫
- 昆虫
- 兔子繁殖
- 0516-787 extendlv: Maximum allocation for logical volume
- canada goose sale online There are many people over there that are desperate lack apt quest for low
- canada goose sale online A majority of the consumers imagine nearly having a range of collective dre
- canada goose factory sale This namely the season for women venture something sexy to convey their fe
- StartUML或Visor画UML类图
- 昆虫繁殖
- mysql.sock丢失问题
- android webview js交互 第一节 (java和js交互)
- pro *c 中调用pl/sql块的参数是否可以是结构体
- c语言相关问题记录
- canada goose sale online In modern society
- parajumpers outlet online When it namely summer
- voj1493 传纸条 dp
- canada goose clearance Almost always the girls tin find millions of choices from own cabinet Every g