Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Bus
- {
- class Program
- {
- static void Main(string[] args)
- {
- int passengers = int.Parse(Console.ReadLine());
- int stations = int.Parse(Console.ReadLine());
- for (int i = 1; i <= stations; i++)
- {
- int outputPassengers = int.Parse(Console.ReadLine());
- int inputPassengers = int.Parse(Console.ReadLine());
- passengers += inputPassengers - outputPassengers;
- if (i % 2 == 1)
- {
- passengers += 2;
- }
- else
- {
- passengers -= 2;
- }
- }
- Console.WriteLine($"The final number of passengers is : {passengers}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement