Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- houses = [int(x) for x in input().split('@')]
- santa_idx = 0
- while True:
- command = input()
- if command == 'Merry Xmas!':
- break
- else:
- command = command.split(' ')
- length = int(command[1])
- santa_idx += length
- if santa_idx >= len(houses):
- dif = santa_idx // len(houses)
- santa_idx -= len(houses) * dif
- if houses[santa_idx] <= 0:
- print(f'House {santa_idx} will have a Merry Christmas.')
- else:
- houses[santa_idx] -= 2
- print(f"Santa's last position was {santa_idx}.")
- if houses.count(0) == len(houses):
- print('Mission was successful.')
- else:
- print(f'Santa has failed {len(houses) - houses.count(0)} houses.')
Add Comment
Please, Sign In to add comment