sibinasto

10.06. Cake

Dec 2nd, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. width = int(input())
  2. length = int(input())
  3. cake = width * length
  4. all = 0
  5. stopped = False
  6. while all < cake:
  7.     pieces = input()
  8.     if pieces == 'STOP':
  9.         stopped = True
  10.         break
  11.     piece = int(pieces)
  12.     all += piece
  13. if stopped:
  14.      print(f"{cake-all} pieces are left.")
  15. if all>cake:
  16.     print(f"No more cake left! You need {all-cake} pieces more.")
Add Comment
Please, Sign In to add comment