Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. Read dimensions
- width = int(input())
- length = int(input())
- height = int(input())
- free_space = width * length * height
- boxes_count = 0
- has_enough_space = True
- # 2. Read boxes count until free space > 0 or Done
- command = input()
- while command != 'Done':
- # 2.1 read boxes count
- # 2.2 calculate boxes volume total
- boxes_count = int(command)
- # 2.3 check if free space is enough
- if free_space >= boxes_count:
- free_space -= boxes_count
- else:
- # 2.4 if not enough
- has_enough_space = False
- break
- command = input()
- # 3. Done -> Print left space
- if has_enough_space:
- print(f'{free_space} Cubic meters left.')
- else:
- print(f'No more free space! You need {boxes_count - free_space} Cubic meters more.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement