Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 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 Problem1
  8. {
  9. class Problem1
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14.  
  15. long TreatedPatients = 0;
  16. long UntreatedPatients = 0;
  17.  
  18. long doctor = 7;
  19.  
  20.  
  21. for (int i = 1; i <= n; i++)
  22. {
  23. long patients = long.Parse(Console.ReadLine());
  24.  
  25. if (patients == doctor)
  26. {
  27. TreatedPatients += doctor;
  28. }
  29. else if (patients > doctor)
  30. {
  31.  
  32. if (i % 3 == 0 )
  33. {
  34. doctor++;
  35. }
  36.  
  37. TreatedPatients += doctor;
  38. patients -= doctor;
  39. UntreatedPatients += patients;
  40.  
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement