Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Problem1
  9. {
  10.     class Problem1
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int n = int.Parse(Console.ReadLine());
  15.  
  16.             long TreatedPatients = 0;
  17.             long UntreatedPatients = 0;
  18.            
  19.             long doctor = 7;
  20.  
  21.  
  22.             for (int i = 1; i <= n; i++)
  23.             {
  24.                   if ((i % 3 == 0) && (UntreatedPatients > TreatedPatients))
  25.                     {
  26.                         doctor++;
  27.                     }
  28.  
  29.                 long patients = long.Parse(Console.ReadLine());
  30.            
  31.                 if (patients == doctor)
  32.                 {
  33.                     TreatedPatients += doctor;
  34.                 }
  35.                 else if (patients > doctor)
  36.                 {
  37.    
  38.                     TreatedPatients += doctor;
  39.                     patients -= doctor;
  40.                     UntreatedPatients += patients;
  41.                    
  42.                 }
  43.                 else
  44.                 {
  45.                     TreatedPatients += patients;
  46.                 }
  47.  
  48.             }
  49.             Console.WriteLine("Treated patients: {0}.", TreatedPatients);
  50.             Console.WriteLine("Untreated patients: {0}.", UntreatedPatients);
  51.  
  52.         }
  53.     }
  54.  
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement