Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. years = int(input())
  2. machine_price = float(input())
  3. toy_price = float(input())
  4. toys_count = 0
  5. money_amount = 0
  6. for year in range(1, years + 1):
  7. if year % 2 == 0:
  8. money_amount += year / 2 * 10
  9. money_amount -= 1
  10. else:
  11. toys_count += 1
  12. toys_price = toys_count * toy_price
  13. total_amount = toys_price + money_amount
  14. if total_amount >= machine_price:
  15. print(f'Yes! {total_amount - machine_price:.2f}')
  16. else:
  17. print(f'No! {machine_price - total_amount:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement