Advertisement
plamen27

Bolnitsa Fixed

Sep 15th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Fixed_Bolnitsa
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int period = int.Parse(Console.ReadLine());
  10. int doctors = 7;
  11. int treatP = 0;
  12. int untreatP = 0;
  13. int patientsOfDay = 0;
  14.  
  15. for (int day = 1; day <= period; day++)
  16. {
  17. patientsOfDay = int.Parse(Console.ReadLine());
  18. if (day % 3 == 0 && treatP < untreatP && day != 1)
  19. {
  20. doctors = doctors + 1;
  21. }
  22. else
  23. { doctors = doctors + 0; }
  24. int result = doctors - patientsOfDay;
  25.  
  26.  
  27. if (result >= 0)
  28. { treatP = treatP + patientsOfDay; }
  29. else
  30. {
  31. treatP = treatP + doctors;
  32. untreatP = untreatP + Math.Abs(result);
  33. }
  34. }
  35. Console.WriteLine("Treated patients: {0}.", treatP);
  36. Console.WriteLine("Untreated patients: {0}.", untreatP);
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement