Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Hospital
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int period = int.Parse(Console.ReadLine());
  14.  
  15.            
  16.             int doctors = 7;
  17.            
  18.             int unacceptedPeople = 0;
  19.             int enteredPeople = 0;
  20.             int count = 1;
  21.             for (int i = 1; i <= period; i++)
  22.             {
  23.                 int patientsDay = int.Parse(Console.ReadLine());
  24.                 if (count == 3)
  25.                 {
  26.                     if (enteredPeople < unacceptedPeople)
  27.                     {
  28.                         doctors++;
  29.                     }
  30.                     count = 0;
  31.                 }
  32.                 if (patientsDay>doctors)
  33.                 {
  34.                     unacceptedPeople += (patientsDay - doctors);
  35.                     enteredPeople += doctors;
  36.                 }
  37.                 else
  38.                 {
  39.                     enteredPeople += patientsDay;
  40.                 }
  41.                 count++;
  42.              }
  43.                 Console.WriteLine("Treated patients: {0}.",enteredPeople);
  44.                 Console.WriteLine("Untreated patients: {0}.",unacceptedPeople);
  45.            
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement