Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 04. Cinema Voucher
- voucher = int(input())
- price = 0
- ticketPcs = 0
- other_product_pcs = 0
- product = input()
- while product != "End":
- if len(product) > 8:
- price = ord(product[0]) + ord(product[1])
- if voucher >= price:
- voucher = voucher - price
- ticketPcs += 1
- else:
- break
- else:
- price = ord(product[0])
- if voucher >= price:
- voucher = voucher - price
- other_product_pcs += 1
- else:
- break
- product = input()
- print(ticketPcs)
- print(other_product_pcs)
Advertisement
Add Comment
Please, Sign In to add comment