Advertisement
Icakman

Bus

Nov 24th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 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 ConsoleApp2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int begin = int.Parse(Console.ReadLine());
  14. int stop = int.Parse(Console.ReadLine());
  15. int total = 0;
  16. switch (stop)
  17. {
  18. case 1:
  19. int a = int.Parse(Console.ReadLine());
  20. int b = int.Parse(Console.ReadLine());
  21. total = begin + a - b;
  22. break;
  23.  
  24. case 2:
  25. int c = int.Parse(Console.ReadLine());
  26. int d = int.Parse(Console.ReadLine());
  27. int cc = int.Parse(Console.ReadLine());
  28. int dd = int.Parse(Console.ReadLine());
  29. total =(begin + d + dd)- (c + cc);
  30. break;
  31.  
  32. case 3:
  33. int e = int.Parse(Console.ReadLine());
  34. int f = int.Parse(Console.ReadLine());
  35. int ee = int.Parse(Console.ReadLine());
  36. int ff = int.Parse(Console.ReadLine());
  37. int eee = int.Parse(Console.ReadLine());
  38. int fff = int.Parse(Console.ReadLine());
  39. total =(begin + f + ff + fff) - (e + ee + eee);
  40. break;
  41.  
  42. case 4:
  43. int g = int.Parse(Console.ReadLine());
  44. int h = int.Parse(Console.ReadLine());
  45. int gg = int.Parse(Console.ReadLine());
  46. int hh = int.Parse(Console.ReadLine());
  47. int ggg = int.Parse(Console.ReadLine());
  48. int hhh = int.Parse(Console.ReadLine());
  49. int gggg = int.Parse(Console.ReadLine());
  50. int hhhh = int.Parse(Console.ReadLine());
  51. total =(begin + h + hh + hhh + hhhh) - (g + gg + ggg + gggg);
  52. break;
  53.  
  54. case 5:
  55. int i = int.Parse(Console.ReadLine());
  56. int j = int.Parse(Console.ReadLine());
  57. int i1 = int.Parse(Console.ReadLine());
  58. int j1 = int.Parse(Console.ReadLine());
  59. int i2 = int.Parse(Console.ReadLine());
  60. int j2 = int.Parse(Console.ReadLine());
  61. int i3 = int.Parse(Console.ReadLine());
  62. int j3 = int.Parse(Console.ReadLine());
  63. int i4 = int.Parse(Console.ReadLine());
  64. int j4 = int.Parse(Console.ReadLine());
  65. total = (begin + j + j1 + j2 + j3 + j4) - (i + i1 + i2 + i3 + i4);
  66. break;
  67.  
  68. }
  69.  
  70. if (stop % 2 != 0)
  71. {
  72. total = total + 2;
  73. }
  74. Console.WriteLine($"The final number of passengers is : {total}");
  75. }
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement