SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Hospital
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int period = int.Parse(Console.ReadLine());
  10.             int daysCount = 0;
  11.             int doctors = 7;
  12.             int currentTreatedPatients = 0;
  13.             int currentUntreatedPatients = 0;
  14.             int treatedPatients = 0;
  15.             int untreatedPatients = 0;
  16.  
  17.             for(int days = 1; days <= period; days++)
  18.             {
  19.                 daysCount++;
  20.                 int patients = int.Parse(Console.ReadLine());
  21.  
  22.                 if (daysCount % 3 == 0)
  23.                 {
  24.                     if (untreatedPatients > treatedPatients)
  25.                     {
  26.                         doctors++;
  27.                         daysCount = 0;
  28.                     }
  29.                 }
  30.                 if(doctors > patients)
  31.                 {
  32.                     currentTreatedPatients += patients;
  33.                 }
  34.  
  35.                 else
  36.                 {
  37.                     currentTreatedPatients += doctors;
  38.                 }
  39.                
  40.                 currentUntreatedPatients = patients - currentTreatedPatients;
  41.                
  42.                 treatedPatients += currentTreatedPatients;
  43.                 untreatedPatients += currentUntreatedPatients;
  44.  
  45.                 currentTreatedPatients = 0;
  46.                 currentUntreatedPatients = 0;
  47.             }
  48.  
  49.             Console.WriteLine($"Treated patients: {treatedPatients}.");
  50.             Console.WriteLine($"Untreated patients: {untreatedPatients}.");
  51.  
  52.         }
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top