Sichanov

sd

Aug 5th, 2021
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. price_of_voucher = int(input())
  2. command = input()
  3. tickets = 0
  4. others = 0
  5. price = 0
  6. while command != 'End':
  7.     product = command
  8.     if len(product) > 8:
  9.         price += ord(product[0]) + ord(product[1])
  10.         if price > price_of_voucher:
  11.             break
  12.         tickets += 1
  13.     else:
  14.         price += ord(product[0])
  15.         if price > price_of_voucher:
  16.             break
  17.         others += 1
  18.     command = input()
  19. print(tickets)
  20. print(others)
  21.  
Advertisement
Add Comment
Please, Sign In to add comment