Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Hospital
- {
- class Program
- {
- static void Main(string[] args)
- {
- var doctors = 7;
- var period = int.Parse(Console.ReadLine());
- var treated = 0;
- var untreated = 0;
- var untreadCalc = 0;
- for (int i = 1; i <= period; i++)
- {
- var numPacients = int.Parse(Console.ReadLine());
- if (i%3!=0)
- {
- if (numPacients <= doctors)
- {
- treated += numPacients;
- }
- if (numPacients > doctors)
- {
- untreadCalc = numPacients - doctors;
- untreated += untreadCalc;
- treated += doctors;
- }
- }
- if((i%3==0))
- {
- if (untreated>treated)
- {
- doctors++;
- }
- if (numPacients <= doctors)
- {
- treated += numPacients;
- }
- if (numPacients > doctors)
- {
- untreadCalc = numPacients - doctors;
- untreated += untreadCalc;
- treated += doctors;
- }
- }
- }
- Console.WriteLine("Treated patients: " + treated+".");
- Console.WriteLine("Untreated patients: " + untreated+".");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment