Guest User

Untitled

a guest
Oct 23rd, 2019
89
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().Trim());
  10. int daysCount = 0;
  11. int doctors = 7;
  12. int treatedPatients = 0;
  13. int untreatedPatients = 0;
  14.  
  15. for(int days = 1; days <= period; days++)
  16. {
  17. int currentTreatedPatients = 0;
  18. int currentUntreatedPatients = 0;
  19. daysCount++;
  20.  
  21. int patients = int.Parse(Console.ReadLine().Trim());
  22.  
  23. if ((daysCount % 3 == 0) && untreatedPatients > treatedPatients)
  24. {
  25. doctors++;
  26. daysCount = 0;
  27. }
  28.  
  29. if(doctors >= patients)
  30. {
  31. currentTreatedPatients += patients;
  32. }
  33. else
  34. {
  35. currentTreatedPatients += doctors;
  36. }
  37.  
  38. currentUntreatedPatients = patients - currentTreatedPatients;
  39.  
  40. treatedPatients += currentTreatedPatients;
  41. untreatedPatients += currentUntreatedPatients;
  42.  
  43. }
  44.  
  45. Console.WriteLine($"Treated patients: {treatedPatients}.");
  46. Console.WriteLine($"Untreated patients: {untreatedPatients}.");
  47.  
  48. }
  49. }
  50. }
RAW Paste Data