viligen

heart_delivery

Oct 22nd, 2021
608
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. houses = list(map(int, input().split("@")))
  2. index = 0
  3. while True:
  4.     command = input().split()
  5.     if "Love!" in command:
  6.         break
  7.     index += int(command[1])
  8.     if 0 > index or index >= len(houses):
  9.         index = 0
  10.     if houses[index] - 2 > 0:
  11.         houses[index] -= 2
  12.     elif houses[index] - 2 == 0:
  13.         print(f"Place {index} has Valentine's day.")
  14.         houses[index] = 0
  15.     elif houses[index] - 2 < 0:
  16.         print(f"Place {index} already had Valentine's day.")
  17.  
  18. print(f"Cupid's last position was {index}.")
  19. if sum(houses) == 0:
  20.     print(f"Mission was successful.")
  21. else:
  22.     house_count = len([n for n in houses if n > 0])
  23.     print(f"Cupid has failed {house_count} places.")
  24.  
RAW Paste Data