Advertisement
barabar4e

3. Harvest

Sep 20th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. from math import floor
  2. from math import ceil
  3.  
  4. x_square_meters_grapes = int(input())
  5. y_kg_grape_for_square_meter = float(input())
  6. z_needed_liters_wine = int(input())
  7. number_workers = int(input())
  8.  
  9. grape_amount = x_square_meters_grapes * y_kg_grape_for_square_meter
  10. wine_amount = ((0.4 * grape_amount) / 2.5)
  11.  
  12. diff = abs(wine_amount - z_needed_liters_wine)
  13.  
  14. if wine_amount >= z_needed_liters_wine:
  15. diff = ceil(diff)
  16. wine_worker = ceil(diff // number_workers)
  17. rounded_wine_amount = floor(wine_amount)
  18. print(f"Good harvest this year! Total wine: {rounded_wine_amount} liters.")
  19. print(f"{diff} liters left -> {wine_worker} liters per person.")
  20. else:
  21. diff = floor(diff)
  22. print(f"It will be a tough winter! More {diff} liters wine needed.")
  23.  
Tags: help
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement