Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The standard price per pair is 100 units.
- # The threshold is 40 units.
- # The discount per purchase is 10 units.
- # Finally, a client's budget is 550.
- # The client will be able to purchase a total of 8 pairs of socks for a total of 530 units and 20 units of change. The first pair will cost the full standard price - 100 units.
- # The second one will cost the standard price minus the discount - 90 units. The third pair will cost 80 units due to the discount accumulating with every purchase. The final bill
- # calculation will look like this: 100+90+80+70+60+50+40+40=530 units.
- # Input
- # 550
- # 100
- # 10
- # 40
- # Output
- # 8,20
- client_budget = int(input())
- standard_price = int(input())
- discount_price = int(input())
- price_threshold = int(input())
- lst = []
- while standard_price > price_threshold:
- lst.append(standard_price)
- standard_price -= discount_price
- sum_without_threshold = sum(lst)
- change = 0
- while sum_without_threshold < client_budget:
- sum_without_threshold += price_threshold
- if sum_without_threshold <= client_budget:
- lst.append(price_threshold)
- else:
- break
- if len(lst) >= 10:
- lst.append(0)
- change = client_budget - sum(lst)
- print(f"{len(lst)}, {change}")
Advertisement
Add Comment
Please, Sign In to add comment