Have you ever wondered why there are so many mosquitos in wet environments? One of the reasons is that adult female mosquitos can lay as many as hundreds of eggs. Even if most of them do not (fortunately!) survive, it is said that a single pair of mosquitos can generate a population of thousands in just a couple of weeks. Let us have a closer look at these numbers. The mosquito life cycle includes four stages: egg, larva, pupa, and adult. For simplicity, we will make several assumptions that are not quite true in the nature: The egg stage lasts less than one day, and all the other stages are one week long. Each mosquito lives as a larva for the first week, the second week “hibernates” in the form of a pupa, and finally, the third week lives as an adult mosquito. At the end of its three-week life, each mosquito lays eggs and dies.
To simplify things even further, we will assume that the transformation from one life stage into another always happens on Sunday. Each Sunday, the following things happen:
• An adult mosquito lays E eggs and dies. Within a day, one larva hatches from each egg.
• Some of the larvae hatched from egg the last Sunday were not strong enough and died or got eaten. Only every R-th larva will transform into a pupa on Sunday.
• An adult mosquito emerges from every S-th pupa, all other pupae dry.
For example, if there are 5 pupae and every 3-rd of them survives, there will be 1 mosquito left. Out of 6 pupae, two adult mosquitos emerge.
In the first week, there are M mosquitos, P pupae and L larvae. Calculate how many mosquitos will there be after N Sunday transformations. Of course, we are counting only living adult mosquitos, not the dry dead bodies.
The input consists of several instances, each instance per one line. Each line contains seven integers M, P, L, E, R, S, N separated by space. M, P and L are the numbers of mosquitos, pupae, and larvae, respectively, in the first week. You may assume that 0 ≤ M,P,L ≤ 100 000, 0 ≤ E ≤ 100, 1 ≤ R, S ≤ 10, and 1 ≤ N ≤ 1000. E is the number of eggs laid by one mosquito, R and S specify the survival rates of larvae and pupae, and N is the number of weeks.
For each input instance, output a single line containing an integer number C, giving the count of mosquitos after the N-th Sunday.
You may assume that the number of mosquitos during each of the first N weeks will not exceed 1 000 000.
10 20 40 4 2 2 10 144 55 8 0 1 9 4 10 10 10 2 3 2 6 10 20 40 86 9 9 999
10 0 1 10 题意 输入 m p l e r s n m是一开始蚊子个数 L是蛹的个数 p是小蚊子的个数 e是每个大蚊子产egg 的个数 r是蛹(L)的成活率 即每r个成活一个 s是小蚊子(p)的成活率从蛹到小蚊子需要一个week 从小蚊子到大蚊子 需要一个week n 是week的个数 大蚊子产生egg 后就会死亡 问你n个week后生成多少个打蚊子 思路 很简单的题 主要是题意不好懂 太坑爹了#include<stdio.h> int main() { int m,p,l,e,sp,n,rl,lastm; while(scanf("%d %d %d %d %d %d %d",&m,&p,&l,&e,&rl,&sp,&n)!=EOF) { while(n--)// egg, larva, pupa, and adult. { lastm=m; m=p/sp; p=l/rl; l=lastm*e; } printf("%d\n",m); } return 0; }