Advertisement
aneliabogeva

Clever Lily

May 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. n = int(input())
  2. price_washing_machine = float(input())
  3. price_toy = float(input())
  4.  
  5. toy_count = 0
  6. money_count = 0
  7. money_brother = 0
  8.  
  9. for i in range(1, n+1):
  10. if i % 2 == 0:
  11. money_count += (i/2)*10
  12. money_count -= 1
  13. else:
  14. toy_count += 1
  15.  
  16. money_from_toys = toy_count * price_toy
  17. money_count += money_from_toys
  18.  
  19.  
  20. if money_count >= price_washing_machine:
  21. print(f"Yes! {abs(money_count-price_washing_machine):.2f}")
  22. else:
  23. print(f"No! {abs(money_count-price_washing_machine):.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement