각 경우의 수를 check 해주면 된다. def check(player, num): if player[num] == 3: return True if num > 1 and player[num - 1] and player[num - 2]: return True if num < 9 and player[num + 1] and player[num + 2]: return True if num and not num==9 and player[num + 1] and player[num - 1]: return True return False for test in range(1, int(input()) + 1): nums = list(map(int, input().split())) a = {i: 0 for i in rang..