In nature, the number of mosquitoes increases when it is warm. Spiders, on the other hand, eat them and keep the mosquito population under control.
We can derive the increase in the number of mosquitoes per week based on the total number of mosquitoes from the previous week and the temperature. If the temperature is below 18 degrees, mosquitoes do not grow. At temperatures above 40 degrees, mosquito eggs die, and mosquitoes also cannot grow. At temperatures between 18 and 39 degrees, growth depends on the temperature according to the formula:
growth factor = (temperature - 18)/21. The number of new mosquitoes in a week is calculated as: new_mosquitoes = growth_factor * number_of_mosquitoes. The number of new mosquitoes is rounded down to the nearest whole number. The chance of being eaten for one mosquito is given by: chance_of_being_eaten = 1 - (0.9 ** number_of_spiders)
The number of mosquitoes eaten is calculated as: eaten_mosquitoes = chance_of_bein_eaten * number_of_mosquitoes. A total of at least 20 mosquitoes eaten results in 1 new spider, while 40 mosquitoes eaten results in 2 new spiders, and so on
Input:
25
Output:
week 0 100 1
week 1 124 1
week 2 153 1
week 3 189 1
week 4 234 1
week 5 289 2
week 6 331 4
week 7 328 9
week 8 237 19
week 9 112 29
week 10 43 34
Input:
0
Output:
It is now too cold for mosquitoes.