Advertisement
horozov86

Dishwasher

Dec 14th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. count_bottles = int(input())
  2.  
  3. total_count_pots = 0
  4. total_count_dishes = 0
  5. count_loadings = 0
  6. detergent_ml = count_bottles * 750
  7. input_line = input()
  8. while input_line != "End":
  9.     count_loadings += 1
  10.     if count_loadings % 3 == 0:
  11.         count_pots = int(input_line)
  12.         detergent_pots = count_pots * 15
  13.         detergent_ml -= detergent_pots
  14.         total_count_pots += count_pots
  15.  
  16.     else:
  17.         count_dishes = int(input_line)
  18.         detergent_dishes = count_dishes * 5
  19.         detergent_ml -= detergent_dishes
  20.         total_count_dishes += count_dishes
  21.  
  22.     if detergent_ml < 0:
  23.         break
  24.  
  25.     input_line = input()
  26.  
  27. if detergent_ml >= 0:
  28.     print(f"Detergent was enough!")
  29.     print(f"{total_count_dishes} dishes and {total_count_pots} pots were washed.")
  30.     print(f"Leftover detergent {detergent_ml} ml.")
  31. else:
  32.     print(f"Not enough detergent, {abs(detergent_ml)} ml. more necessary!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement