Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int begin = int.Parse(Console.ReadLine());
- int stop = int.Parse(Console.ReadLine());
- int total = 0;
- switch (stop)
- {
- case 1:
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- total = begin + a - b;
- break;
- case 2:
- int c = int.Parse(Console.ReadLine());
- int d = int.Parse(Console.ReadLine());
- int cc = int.Parse(Console.ReadLine());
- int dd = int.Parse(Console.ReadLine());
- total =(begin + d + dd)- (c + cc);
- break;
- case 3:
- int e = int.Parse(Console.ReadLine());
- int f = int.Parse(Console.ReadLine());
- int ee = int.Parse(Console.ReadLine());
- int ff = int.Parse(Console.ReadLine());
- int eee = int.Parse(Console.ReadLine());
- int fff = int.Parse(Console.ReadLine());
- total =(begin + f + ff + fff) - (e + ee + eee);
- break;
- case 4:
- int g = int.Parse(Console.ReadLine());
- int h = int.Parse(Console.ReadLine());
- int gg = int.Parse(Console.ReadLine());
- int hh = int.Parse(Console.ReadLine());
- int ggg = int.Parse(Console.ReadLine());
- int hhh = int.Parse(Console.ReadLine());
- int gggg = int.Parse(Console.ReadLine());
- int hhhh = int.Parse(Console.ReadLine());
- total =(begin + h + hh + hhh + hhhh) - (g + gg + ggg + gggg);
- break;
- case 5:
- int i = int.Parse(Console.ReadLine());
- int j = int.Parse(Console.ReadLine());
- int i1 = int.Parse(Console.ReadLine());
- int j1 = int.Parse(Console.ReadLine());
- int i2 = int.Parse(Console.ReadLine());
- int j2 = int.Parse(Console.ReadLine());
- int i3 = int.Parse(Console.ReadLine());
- int j3 = int.Parse(Console.ReadLine());
- int i4 = int.Parse(Console.ReadLine());
- int j4 = int.Parse(Console.ReadLine());
- total = (begin + j + j1 + j2 + j3 + j4) - (i + i1 + i2 + i3 + i4);
- break;
- }
- if (stop % 2 != 0)
- {
- total = total + 2;
- }
- Console.WriteLine($"The final number of passengers is : {total}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement