Advertisement
Spocoman

Juice Diet

Oct 9th, 2023 (edited)
954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. r = int(input())
  2. s = int(input())
  3. c = int(input())
  4. max_juice = int(input())
  5.  
  6. juice = 0
  7. raspberries = 0
  8. strawberries = 0
  9. cherries = 0
  10.  
  11. for j in range(r + 1):
  12.     for k in range(s + 1):
  13.         for l in range(c + 1):
  14.             current_juice = 4.5 * j + 7.5 * k + 15 * l
  15.             if juice < current_juice <= max_juice:
  16.                 juice = current_juice
  17.                 raspberries = j
  18.                 strawberries = k
  19.                 cherries = l
  20.  
  21. print(f"{raspberries} Raspberries, {strawberries} Strawberries, {cherries} Cherries. Juice: {int(juice)} ml.")
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement