Advertisement
Guest User

Untitled

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