Page 1 of 1

Hospital: ● For a period of time, patients are arriving every day in the hospital for examination. ● It has initially 7

Posted: Sun Jul 03, 2022 11:22 am
by answerhappygod
Hospital: ● For a period of time, patients are arriving everyday in the hospital for examination. ● It has initially 7 doctors.● Each doctor can only review one patient per day, but sometimesthere is a shortage of doctors, so other patients are sent to otherhospitals. ● Every third day the hospital makes calculations and ifthe number of unreviewed patients is greater than the number ofreviewed, one more doctor is appointed. ● As the appointment of thedoctor occurs before the intake of patients for the day. ● Write aprogram that calculates the number of reviewed and unreviewedpatients for the given period. Input The input is read from theconsole and contains: ● The period for which you need to performcalculations - integer in range [1... 1000] ● On the followinglines (equal to the number of days) – the number of patientsarriving for review for the current day - integer in range [0... 10000] Output Print on the console 2 lines: ● First line: "Treatedpatients: {Number of patients reviewed}." ● Second line: "Untreatedpatients: {Number of unreviewed patients}." Example Input Output 4Treated patients: 23 7 Untreated patients: 21 27 9 1 Comments ● Day1: 7 treated and 0 untreated patients for the day ● Day 2: 7treated and 20 untreated patients for the day ● Day 3: Until now,the patients treated were 14 and untreated – 20 – > A new doctoris appointed – > 8 treated and 1 untreated patient for the day ●Day 4: 1 treated and 0 untreated patient for the day ● Total: 23treated
and 21 untreated patients
JS