Problem: Hospital

For a certain period of time, patients arrive at the hospital each day for a treatment. It has initially 7 doctors. Every doctor can treat only one pacient per day, but sometimes there is a shortage of doctors, so the remaining patients are sent to other hospotals. Every third day the hospital makes calculations and if count of untreated patients is greater than the count of treated, another doctor is appointed. Appointment takes place before the daily patient intake begins.

Write a program, that calculates for the given period of time count of treated and untreated patients.

Input Data

Input is read from the console and contains:

  • On the first line – The period, for which you need to make calculations. Integer number in range [1 … 1000].
  • On the next lines (equals to the count of days) – count of the patients, who arrive for treatment for the current day. Integer number in range [0 … 10 000].

Output Data

Print on the console 2 lines:

  • On the first line: “Treated patients: {count of treated patients}.
  • On the second line: “Untreated patients: {count of untreated patients}.

Sample Input and Output

Input Output Comments
4
7
27
9
1
Treated patients: 23.
Untreated patients: 21.

1 day: 7 treated and 0 untreated patients for the day
2 day: 7 treated and 20 untreated patients for the day
3 day: By this moment the treated patiens are 14,
and untreated – 20 –> Appointed new doctor.
–> 8 treated and 1 untreated patient for the day
4 day: 1 treated and 0 untreated patients for the day
Total: 23 treated and 21 untreated patiens.

Input Output
6
25
25
25
25
25
2
Treated patients: 40.
Untreated patients: 87.
3
7
7
7
Treated patients: 21.
Untreated patients: 0.

results matching ""

    No results matching ""