diff --git "a/Hyukey/230705_Baekjoon_\355\201\254\353\241\234\354\212\244\354\233\214\353\223\234_\355\215\274\354\246\220_\354\263\220\353\213\244\353\263\264\352\270\260.py" "b/Hyukey/230705_Baekjoon_\355\201\254\353\241\234\354\212\244\354\233\214\353\223\234_\355\215\274\354\246\220_\354\263\220\353\213\244\353\263\264\352\270\260.py" new file mode 100644 index 0000000..7cdde8f --- /dev/null +++ "b/Hyukey/230705_Baekjoon_\355\201\254\353\241\234\354\212\244\354\233\214\353\223\234_\355\215\274\354\246\220_\354\263\220\353\213\244\353\263\264\352\270\260.py" @@ -0,0 +1,36 @@ +R, C = map(int, input().split()) + +puzzle = [list(input()) for _ in range(R)] +dic = [] + + +for i in range(R): + col = 0 + word = '' + while col < C: + if puzzle[i][col] != '#': + word += puzzle[i][col] + else: + if len(word) > 1: + dic.append(word) + word = '' + col += 1 + if len(word) > 1: + dic.append(word) + +for j in range(C): + row = 0 + word = '' + while row < R: + if puzzle[row][j] != '#': + word += puzzle[row][j] + else: + if len(word) > 1: + dic.append(word) + word = '' + row += 1 + if len(word) > 1: + dic.append(word) + +dic.sort() +print(dic[0]) \ No newline at end of file diff --git "a/Hyukey/230712_Baekjoon_\353\213\254\355\214\275\354\235\264.py" "b/Hyukey/230712_Baekjoon_\353\213\254\355\214\275\354\235\264.py" new file mode 100644 index 0000000..a9a33ea --- /dev/null +++ "b/Hyukey/230712_Baekjoon_\353\213\254\355\214\275\354\235\264.py" @@ -0,0 +1,31 @@ +N = int(input()) +num = int(input()) + +board = [[0] * N for _ in range(N)] + +movement = [(0, 1), (1, 0), (0, -1), (-1, 0)] + +cur_num = 1 +step = 0 +cur_row, cur_col = N//2, N//2 + +board[cur_row][cur_col] = cur_num +ans_row, ans_col = cur_row, cur_col + +while cur_num < N**2: + cur_row -= 1 + cur_col -= 1 + step += 2 + + for d_row, d_col in movement: + for _ in range(step): + cur_num += 1 + cur_row += d_row + cur_col += d_col + board[cur_row][cur_col] = cur_num + if cur_num == num: + ans_row, ans_col = cur_row, cur_col + +for row in board: + print(" ".join(map(str, row))) +print(ans_row+1, ans_col+1) \ No newline at end of file