Advertisement
NonaG

Hospital

Dec 13th, 2016
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 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. var period = int.Parse(Console.ReadLine());
  14. var countpatients = 0;
  15. var waiting = 0;
  16. var countwaiting = 0;
  17. var examed = 0;
  18. var countexamed = 0;
  19. var numberdoctors = 7;
  20. for (int i = 1; i <= period; i++)
  21. {
  22. var numberpatients = int.Parse(Console.ReadLine());
  23. if (i %3==0 && countexamed < countwaiting)
  24. {
  25. numberdoctors++;
  26. }
  27. countpatients += numberpatients;
  28. if (numberdoctors <= numberpatients)
  29. {
  30. examed = numberdoctors;
  31. waiting = numberpatients - numberdoctors;
  32.  
  33. }
  34. if (numberdoctors > numberpatients)
  35. {
  36. examed = numberpatients;
  37. }
  38. countexamed += examed;
  39. countwaiting = countpatients - countexamed;
  40.  
  41.  
  42. }
  43. Console.WriteLine("Treated patients: {0}.",countexamed);
  44. Console.WriteLine("Untreated patients: {0}.",countwaiting);
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement