Mira2706

1 zad

Jun 18th, 2023
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | Source Code | 0 0
  1. days = int(input())
  2. players = int(input())
  3. total_energy = float(input())
  4. daily_water_pp = float(input())
  5. daily_food_pp = float(input())
  6.  
  7. water_needed = daily_water_pp * days * players
  8. food_needed = daily_food_pp * days * players
  9. curr_water = water_needed
  10. curr_food = food_needed
  11. flag = True
  12. for i in range(1, days + 1):
  13.     wood_chop = float(input())
  14.     if total_energy > 0:
  15.         total_energy -= wood_chop
  16.     else:
  17.         flag = False
  18.         print(f"You will run out of energy. You will be left with {curr_food:.2f} food and {curr_water:.2f} water.")
  19.         break
  20.     if i % 2 == 0:
  21.         total_energy += total_energy / 20
  22.         curr_water -= curr_water * 3 / 10
  23.     if i % 3 == 0:
  24.         total_energy += total_energy / 10
  25.         curr_food -= curr_food / players
  26.  
  27. if flag:
  28.     print(f"You are ready for the quest. You will be left with - {total_energy:.2f} energy!")
Advertisement
Add Comment
Please, Sign In to add comment