viligen

shoot_for_the_win

Oct 21st, 2021
842
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. target_state = list(map(int, input().split()))
  2. range_index = range(0, len(target_state))
  3. count = 0
  4. while True:
  5.     index_str = input()
  6.     if "End" in index_str:
  7.         break
  8.     index = int(index_str)
  9.     if index in range_index and target_state[index] != -1:
  10.         for i in range(len(target_state)):
  11.             if target_state[i] > target_state[index] and target_state[i] != -1 and i != index:
  12.                 target_state[i] -= target_state[index]
  13.             elif target_state[i] <= target_state[index] and target_state[i] != -1 and i != index:
  14.                 target_state[i] += target_state[index]
  15.         target_state[index] = -1
  16.         count += 1
  17. print(f"Shot targets: {count} ->", *target_state)
  18.  
  19.  
  20.  
  21.  
RAW Paste Data