Advertisement
Spocoman

Bus

Oct 9th, 2023 (edited)
1,498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. passengers = int(input())
  2. stations = int(input())
  3.  
  4. for i in range(1, stations + 1):
  5.     output_passengers = int(input())
  6.     input_passengers = int(input())
  7.  
  8.     passengers += input_passengers - output_passengers
  9.  
  10.     if i % 2 == 1:
  11.         passengers += 2
  12.     else:
  13.         passengers -= 2
  14.  
  15. print(f"The final number of passengers is : {passengers}")
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement