Advertisement
Spocoman

06. Pets

Dec 18th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import math
  2.  
  3. day = int(input())
  4. food_kg = float(input())
  5. dog_kg = float(input())
  6. cat_kg = float(input())
  7. turtle_gr = float(input())
  8.  
  9. total_kg = dog_kg * day + cat_kg * day + turtle_gr / 1000 * day
  10.  
  11. if food_kg >= total_kg:
  12.     print(f'{math.floor(food_kg - total_kg)} kilos of food left.')
  13. else:
  14.     print(f'{math.ceil(total_kg - food_kg)} more kilos of food are needed.')
  15.  
  16.  
  17. Тарикатско решение:)
  18.  
  19. import math
  20.  
  21. day = int(input())
  22. food_kg = float(input())
  23.  
  24. total_kg = (float(input()) + float(input()) + float(input()) / 1000) * day
  25.  
  26. if food_kg >= total_kg:
  27.     print(f'{math.floor(food_kg - total_kg)} kilos of food left.')
  28. else:
  29.     print(f'{math.ceil(total_kg - food_kg)} more kilos of food are needed.')
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement