Задача 04. Hospital от глава 5.2. Loops - Exam Problems от книга "Основи на програмирането" (с Python)
Здравейте. На това решение на задачата получих 90/100. Моля за съдействиел
period = int(input())
docs = 7
yes = 0
no = 0
yes_3 = 0
no_3 = 0
if period == 0:
exit()
for day in range(1, period + 1):
people = int(input())
if day % 3 == 0:
if no_3 > yes_3:
docs += 1
yes_3 = 0
no_3 = 0
if docs >= people:
yes += people
yes_3 += people
else:
yes += docs
no += people - docs
yes_3 += docs
no_3 += people - docs
print(f"Treated patients: {yes}.")
print(f"Untreated patients: {no}.")