diff --git a/H0ngJu/README.md b/H0ngJu/README.md index 054beca9..c14c8707 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -9,8 +9,9 @@ | 5차시 | 2024.03.16 | 구현 | [요세푸스 문제](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 | | 6차시 | 2024.03.19 | 스택 | [오큰수](https://www.acmicpc.net/problem/17298) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/164 | | 7차시 | 2024.03.22 | DP | [1,2,3 더하기](https://www.acmicpc.net/problem/9095) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/166 | -| 8차시 | 2024.03.16 | DP | [쉬운 계단 수](https://www.acmicpc.net/problem/10844) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/170 | -| 9차시 | 2024.03.22 | DP | [RGB거리 2](https://www.acmicpc.net/problem/17404) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/172 | +| 8차시 | 2024.03.16 | DP | [쉬운 계단 수](https://www.acmicpc.net/problem/10844) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/170 | +| 9차시 | 2024.03.22 | DP | [RGB거리 2](https://www.acmicpc.net/problem/17404) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/172 | | 10차시 | 2024.04.03 | BFS | [숨바꼭질 4](https://www.acmicpc.net/problem/13913) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/177 | +| 11차시 | 2024.04.07 | 구현 | [사탕 게임](https://www.acmicpc.net/problem/9095) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/178 | --- diff --git "a/H0ngJu/\352\265\254\355\230\204/\354\202\254\355\203\225 \352\262\214\354\236\204.py" "b/H0ngJu/\352\265\254\355\230\204/\354\202\254\355\203\225 \352\262\214\354\236\204.py" new file mode 100644 index 00000000..e2c0a578 --- /dev/null +++ "b/H0ngJu/\352\265\254\355\230\204/\354\202\254\355\203\225 \352\262\214\354\236\204.py" @@ -0,0 +1,44 @@ +import sys + +def input(): return sys.stdin.readline().rstrip() + +def eat(row, col): + row_cnt = 0 + col_cnt = 0 + tmp_col = 1 + tmp_row = 1 + for idx in range(N-1): + # 열에서 먹을 때 + if data[row][idx] == data[row][idx+1]: + tmp_col += 1 + col_cnt = max(col_cnt, tmp_col) + else: + tmp_col = 1 + + # 행에서 먹을 때 + if data[idx][col] == data[idx+1][col]: + tmp_row += 1 + row_cnt = max(row_cnt, tmp_row) + else: + tmp_row = 1 + + return max(row_cnt, col_cnt) + + +N = int(input()) +data = [[x for x in input()] for _ in range(N)] +directions = [(0,-1), (0,1), (-1,0),(1,0)] +cnt = 0 + +for i in range(N): + for k in range(N): + for dir in directions: + dx, dy = dir + x = i+dx + y = k+dy + if 0<=x