Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def main():
- people = int(input())
- infectPeople = int(input())
- recoveryDay = int(input())
- protectedRate = float(input())
- periodWeek = int(input())
- waitRecovery = [0]*recoveryDay + [people]
- target = float('inf')
- for i in range(periodWeek):
- thisWeekInfect, thisWeekNewInfect, thisWeekRecovery = 0, 0, 0
- for j in range(7):
- if i == 0 and j == 0:
- thisWeekNewInfect += people
- thisWeekInfect += people
- continue
- waitRecovery.append(int(people*(infectPeople/recoveryDay)*(1-protectedRate)))
- people = people + waitRecovery[-1] - waitRecovery[i*7+j]
- thisWeekNewInfect += waitRecovery[-1]
- thisWeekInfect += people
- thisWeekRecovery += waitRecovery[i*7+j]
- averageWeekNewInfect = math.ceil(thisWeekNewInfect/7)
- print(f'(Week {i+1}, {math.ceil(thisWeekInfect/7)}, {averageWeekNewInfect}, {math.ceil(thisWeekRecovery/7)})')
- if averageWeekNewInfect == 0:
- target = min(target, i+1)
- print(target)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement