bacco

Болница

Feb 4th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var time = int.Parse(Console.ReadLine());
  10.  
  11.  
  12.             var doctors = 7;
  13.             var treatedPatients = 0;
  14.             var unTreatedPatients = 0;
  15.  
  16.  
  17.             for (int day = 1; day <= time; day++)
  18.             {
  19.                 var currentPatients = int.Parse(Console.ReadLine());
  20.  
  21.  
  22.                 if ((day % 3 == 0) && (unTreatedPatients > treatedPatients))
  23.                 {
  24.                     doctors = doctors + 1;
  25.                 }
  26.  
  27.                 if (currentPatients > doctors)
  28.                 {
  29.                     unTreatedPatients = unTreatedPatients + (currentPatients - doctors);
  30.  
  31.  
  32.                     treatedPatients = treatedPatients + doctors;
  33.                 }
  34.                 else
  35.                 {
  36.                     treatedPatients = treatedPatients + currentPatients;
  37.                 }
  38.             }
  39.             Console.WriteLine($"Treated patients: {treatedPatients}.");
  40.             Console.WriteLine($"Untreated patients: {unTreatedPatients}.");
  41.  
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment