Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. bottles = int(input())
  2. liquid = 750 * bottles
  3.  
  4. is_enough = True
  5. counter = 0
  6. dishes = 0
  7. pots = 0
  8. command = input()
  9. while command != "End":
  10.     count = int(command)
  11.     counter += 1
  12.     if counter % 3 == 0:
  13.         liquid -= count * 15
  14.         if liquid < 0:
  15.             is_enough = False
  16.             break
  17.         elif liquid == 0:
  18.             pots += count
  19.             break
  20.         else:
  21.             pots += count
  22.             command = input()
  23.     else:
  24.         liquid -= count * 5
  25.         if liquid < 0:
  26.             is_enough = False
  27.             break
  28.         elif liquid == 0:
  29.             dishes += count
  30.             break
  31.         else:
  32.             dishes += count
  33.             command = input()
  34.    
  35. if is_enough:
  36.     print('Detergent was enough!')
  37.     print(f'{dishes} dishes and {pots} pots were washed.')
  38.     print(f'Leftover detergent {liquid} ml.')
  39. elif not is_enough:
  40.     print(f'Not enough detergent, {abs(liquid)} ml. more necessary!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement