Advertisement
Guest User

smrl

a guest
Feb 20th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Hospital
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9. int days = int.Parse(Console.ReadLine());
  10. int patients;
  11. int treatPats = 0;
  12. int untreatPats = 0;
  13.  
  14. int doctors = 7;
  15.  
  16. for (int i = 1; i <= days; i++)
  17. {
  18. patients = int.Parse(Console.ReadLine());
  19.  
  20. if (i % 3 == 0)
  21. {
  22. if (treatPats < untreatPats)
  23. {
  24. doctors++;
  25. }
  26.  
  27. if (patients >= doctors)
  28. {
  29. treatPats = treatPats + doctors;
  30. untreatPats = untreatPats + (patients - doctors);
  31. }
  32. else
  33. {
  34. treatPats = treatPats + patients;
  35. }
  36.  
  37. }
  38. else
  39. {
  40. if (patients >= doctors)
  41. {
  42. treatPats = treatPats + doctors;
  43. untreatPats = untreatPats + (patients - doctors);
  44. }
  45. else
  46. {
  47. treatPats = treatPats + patients;
  48. }
  49.  
  50. }
  51. }
  52. Console.WriteLine("Treated patients: {0}.", treatPats);
  53. Console.WriteLine("Untreated patients: {0}.", untreatPats);
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement