Advertisement
bl00dt3ars

02. Shoot for the Win

Jul 3rd, 2021
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. targets = [int(el) for el in input().split()]
  2. shot_targets = []
  3. command = input()
  4.  
  5. while not command == "End":
  6.     index = int(command)
  7.     if index not in shot_targets and 0 <= index < len(targets):
  8.         shot_targets.append(index)
  9.         for i in range(len(targets)):
  10.             if i not in shot_targets:
  11.                 if targets[i] <= targets[index]:
  12.                     targets[i] = targets[i] + targets[index]
  13.                 else:
  14.                     targets[i] = targets[i] - targets[index]
  15.         targets[index] = -1
  16.     command = input()
  17.  
  18. print(f"Shot targets: {targets.count(-1)} -> {' '.join([str(el) for el in targets])}")
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement