Advertisement
simeonshopov

Office Chairs

Feb 14th, 2020
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. n = int(input())
  2. left_chairs = 0
  3. enough_chairs = True
  4.  
  5. for i in range(1, n + 1):
  6.     tokens = input().split(' ')
  7.     chairs = len(tokens[0])
  8.     people = int(tokens[1])
  9.     if chairs >= people:
  10.         left_chairs += chairs - people
  11.     else:
  12.         print(f'{people - chairs} more chairs needed in room {i}')
  13.         enough_chairs = False
  14.  
  15. if enough_chairs:
  16.     print(f'Game On, {left_chairs} free chairs left')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement