Advertisement
BbJLeB

05. Bus

Jun 9th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # 05. Bus
  2.  
  3. travelers = int(input())
  4. stops = int(input())
  5. i = 1
  6. while i <= stops:
  7.     if i % 2 == 0:
  8.         travelers -= int(input())
  9.         travelers += int(input())
  10.         travelers -= 2
  11.     else:
  12.         travelers -= int(input())
  13.         travelers += int(input())
  14.         travelers += 2
  15.     i += 1
  16. print(f"The final number of passengers is : {travelers}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement