Advertisement
anton_d

01.dishwasher

Feb 3rd, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. detergent = int(input()) * 750
  2.  
  3. loads = 1
  4. command = ''
  5. plates = 0
  6. pots = 0
  7.  
  8. while command != 'End' and detergent > 0:
  9.     command = input()
  10.     if command.isnumeric():
  11.         command = int(command)
  12.     else:
  13.         break
  14.     if loads == 3:
  15.         loads = 1
  16.         pots += command
  17.         detergent_used = command * 15
  18.         detergent -= detergent_used
  19.     else:
  20.         loads += 1
  21.         plates += command
  22.         detergent_used = command * 5
  23.         detergent -= detergent_used
  24.  
  25. if detergent >= 0:
  26.     print(f'Detergent was enough!\n{plates} dishes and {pots} pots were washed.\nLeftover detergent {abs(detergent)} ml.')
  27. else:
  28.     print(f'Not enough detergent, {abs(detergent)} ml. more necessary!')
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement