diff --git "a/\352\265\254\355\230\204/BOJ_1283_\353\213\250\354\266\225\355\202\244\354\247\200\354\240\225_\353\260\200\353\246\254.py" "b/\352\265\254\355\230\204/BOJ_1283_\353\213\250\354\266\225\355\202\244\354\247\200\354\240\225_\353\260\200\353\246\254.py" new file mode 100644 index 0000000..95e55e4 --- /dev/null +++ "b/\352\265\254\355\230\204/BOJ_1283_\353\213\250\354\266\225\355\202\244\354\247\200\354\240\225_\353\260\200\353\246\254.py" @@ -0,0 +1,35 @@ +n = int(input()) +keys = [] +options = [] +completed = [False] * n +for i in range(n): + options.append(list(map(str, input().split()))) + +for i in range(n): + # 1단계 + for j in range(len(options[i])): + if options[i][j][0].lower() in keys: + continue + else: + keys.append(options[i][j][0].lower()) + options[i][j] = '[' + options[i][j][0] + ']' + options[i][j][1:] + completed[i] = True + break + # 2단계 + for j in range(len(options[i])): + if completed[i] == True: + break + for h in range(len(options[i][j])): + if options[i][j][h].lower() in keys: + continue + else: + keys.append(options[i][j][h].lower()) + options[i][j] = options[i][j][:h] + '[' + options[i][j][h] + ']' + options[i][j][h+1:] + completed[i] = True + break + +for i in range(n): + for j in options[i]: + print(j, end=" ") + print() + \ No newline at end of file diff --git "a/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ_2615_\354\230\244\353\252\251_\353\260\200\353\246\254.py" "b/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ_2615_\354\230\244\353\252\251_\353\260\200\353\246\254.py" new file mode 100644 index 0000000..1bb315e --- /dev/null +++ "b/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ_2615_\354\230\244\353\252\251_\353\260\200\353\246\254.py" @@ -0,0 +1,47 @@ +def findWinner(): + board = [] + for i in range(19): + board.append(list(map(int, input().split()))) + + # 동북, 동, 동남, 남 + dx = [-1, 0, 1, 1] + dy = [1, 1, 1, 0] + + for x in range(19): + for y in range(19): + if board[x][y] == 0: + continue + current = board[x][y] + # 총 4 방향에 대해서 확인 + for i in range(4): + flag = 0 + nx, ny = x, y + # 바둑알의 색이 현재 위치에서 총 5개까지 일치하는지 확인 + for _ in range(4): + nx = nx + dx[i] + ny = ny + dy[i] + if nx < 0 or nx >= 19 or ny < 0 or ny >= 19: + flag = 1 + break + if board[nx][ny] != current: + flag = 1 + break + # 다음 6번째 알이 일치하면 이긴 것이 아님 + nx = nx + dx[i] + ny = ny + dy[i] + if 0 <= nx < 19 and 0 <= ny < 19: + if board[nx][ny] == current: + flag = 1 + # 이전 알이 일치하면 이긴 것이 아님 + nx = x - dx[i] + ny = y - dy[i] + if 0 <= nx < 19 and 0 <= ny < 19: + if board[nx][ny] == current: + flag = 1 + if flag == 0: + print(current) + print(x+1, y+1) + return + print(0) + +findWinner()