EmoRz

Hospital

Jul 18th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Hospital
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var doctors = 7;
  10.  
  11.             var period = int.Parse(Console.ReadLine());
  12.             var treated = 0;
  13.             var untreated = 0;
  14.             var untreadCalc = 0;
  15.  
  16.  
  17.             for (int i = 1; i <= period; i++)
  18.             {
  19.                 var numPacients = int.Parse(Console.ReadLine());
  20.                 if (i%3!=0)
  21.                 {
  22.                     if (numPacients <= doctors)
  23.                     {
  24.                         treated += numPacients;
  25.                     }
  26.                     if (numPacients > doctors)
  27.                     {
  28.                         untreadCalc = numPacients - doctors;
  29.                         untreated += untreadCalc;
  30.                         treated += doctors;
  31.                     }
  32.                 }
  33.                 if((i%3==0))
  34.                 {
  35.                     if (untreated>treated)
  36.                     {
  37.                         doctors++;
  38.                     }
  39.                     if (numPacients <= doctors)
  40.                     {
  41.                         treated += numPacients;
  42.                     }
  43.                     if (numPacients > doctors)
  44.                     {
  45.                         untreadCalc = numPacients - doctors;
  46.                         untreated += untreadCalc;
  47.                         treated += doctors;
  48.                     }
  49.                 }
  50.             }
  51.             Console.WriteLine("Treated patients: " + treated+".");
  52.             Console.WriteLine("Untreated patients: " + untreated+".");
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment