simeonshopov

Hospital

Oct 16th, 2019
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. period = int(input())
  2. doctors = 7
  3. seen = 0
  4. not_seen = 0
  5.  
  6. for i in range(1, period + 1):
  7.   people = int(input())
  8.   if i % 3 == 0:
  9.     if not_seen > seen:
  10.       doctors += 1
  11.     else:
  12.       doctors = doctors
  13.      
  14.     if people >= doctors:
  15.       seen += doctors
  16.       not_seen += (people - doctors)
  17.     else:
  18.       seen += people
  19.       not_seen += 0
  20.      
  21.   else:
  22.     if people >= doctors:
  23.       seen += doctors
  24.       not_seen += (people - doctors)
  25.     else:
  26.       seen += people
  27.       not_seen += 0
  28.      
  29. print(f"Treated patients: {seen}.")
  30. print(f"Untreated patients: {not_seen}.")
Advertisement
Add Comment
Please, Sign In to add comment