Original problem: ccc20j2
People who study epidemiology use models to analyze the spread of disease. In this problem, we use a simple model. When a person has a disease, they infect exactly RR other people but only on the very next day. No person is infected more than once. We want to determine when a total of more than PP people have had the disease.
This one is basically the same with ccc17j2|python|superposition problem in for loop
17 | 20 | |
constant number | n | n |
repeat num(exponent) | k | ? |
main num | 10 | r |
formula | n+n*10+n*10*10... | n+n*r+n*r*r... |
difference | we got all we want just calculate | we need repeat num but we have extra condition, to compare with P |
loop | for loop: cz we have repeat number, that means we have the range. for loop is the one asking for range | while loop: cz we don't have repeat num but we have condition, while loop is the one asking for condition |
#CCC '20 J2 - Epidemiology
#E Sun
#2021.08.26
p=int(input())
n=int(input())
r=int(input())
total=n
count=0
while total<=p:
n=n*r
total+=n
count+=1
print(count)