Advertisement
Spocoman

01. Santa's Cookies

Feb 15th, 2024
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. cup = 140
  2. big_spoon = 20
  3. small_spoon = 10
  4. cookies_per_box = 5
  5. single_cookie_grams = 25
  6.  
  7. batches = int(input())
  8.  
  9. total_boxes = 0
  10.  
  11. for b in range(batches):
  12.     flour = int(input())
  13.     sugar = int(input())
  14.     cocoa = int(input())
  15.  
  16.     flour_cups = flour // cup
  17.     sugar_spoons = sugar // big_spoon
  18.     cocoa_spoons = cocoa // small_spoon
  19.  
  20.     boxes_of_cookies = ((cup + big_spoon + small_spoon) \
  21.                         * min(flour_cups, sugar_spoons, cocoa_spoons) \
  22.                         // single_cookie_grams // cookies_per_box)
  23.  
  24.     if boxes_of_cookies == 0:
  25.         print('Ingredients are not enough for a box of cookies.')
  26.     else:
  27.         print(f'Boxes of cookies: {boxes_of_cookies}')
  28.         total_boxes += boxes_of_cookies
  29.  
  30. print(f'Total boxes: {total_boxes}')
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement