Anzzhhela98

Untitled

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