Quantity of White Mice
Time limit1sMemory limit128 MB
Simulate monthly mouse pairs with age-based births, death after month n, and newborn removal past 100 survivors to find the month k count.
- Level
Easy3 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Problem
A laboratory keeps one species of white mouse. Each mouse lives only months after birth (, is a natural number). Age counts the month of birth as month 1, so a mouse born in January is in its fourth month in April.
The mice start giving birth in month 7. In months 7 and 8, every pair of parent mice gives birth to one pair of mice per month. Starting in month 9 and lasting months (, is a natural number), every pair of parent mice gives birth to two pairs of mice per month. After that they give birth no more and live out the rest of their life. A mouse dies at the beginning of its month and is taken out of the lab right away. Month does not count as time alive.
A month runs in this order.
- Every mouse that reaches month dies and leaves the lab.
- Count how many pairs survived from the previous month.
- The mice that are due to give birth this month give birth. If the count from step 2 is at most 100 pairs, every pair born this month stays in the lab. If it is more than 100 pairs, every pair born this month goes to another laboratory. Pairs that leave are not part of this lab's count and never give birth here.
At the start the lab holds one newborn pair, and month 1 of that pair is month 1 overall. Find how many pairs of mice are in this lab in month (, is a natural number).
Input
Each line holds one group of data: three natural numbers , , separated by commas. A line holding -1 comes after all the groups and marks the end of the input.
Output
Print one line for each group. The line starts with the input data copied back, then a colon and a space, then the computed number of pairs of white mice.