Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- period = int(input())
- treated = 0
- untreated = 0
- doctors = 7
- for i in range(1, period + 1):
- patients = int(input())
- if untreated > treated and i % 3 == 0:
- doctors += 1
- if patients > doctors:
- treated += doctors
- untreated += patients - doctors
- else:
- treated += patients
- print(f'Treated patients: {treated}.\nUntreated patients: {untreated}.')
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- period = int(input())
- treated = 0
- untreated = 0
- doctors = 7
- for i in range(1, period + 1):
- patients = int(input())
- doctors += (1 if untreated > treated and i % 3 == 0 else 0)
- treated += (doctors if patients > doctors else patients)
- untreated += (patients - doctors if patients > doctors else 0)
- print(f'Treated patients: {treated}.\nUntreated patients: {untreated}.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement