Epidemic Spread
A new pandemic is always possible (and feared), but recent experience has shown that science is currently capable of developing effective vaccines in a very short time. Another consequence of the recent pandemic is that much has been studied about epidemics in general, and several mathematical models have been developed.
In this problem we will use a simple epidemic model:
- When a person is infected, they infect other
Rpeople, but only the day after their infection (Ris called the reproductive factor of infection). - No one is infected more than once.
For example, if on day 0 of the epidemic 3 people are infected and the reproductive factor R is equal to 2, then on day 1 another 6 people are infected (3 + 6 = 9 people in total), on day 2 another 12 people are infected (3 + 6 + 12 = 21 people in total), on day 3 another 24 people infected (3 + 6 + 12 + 24 = 45 people in total), and so on.
Given the initial number of people infected on day 0 N and the reproductive factor of the epidemic R, write a program to determine the number of days it takes for the epidemic to infect T or more people in total.
Input: Three integers (int).
Output: Integer.
Examples:
assert epid_days(1, 5, 156) == 3 assert epid_days(2, 1, 11) == 5 assert epid_days(1, 1, 1) == 0
Preconditions:
- N, R, T > 0.