From 27c07988e33648029bc870b7a5d22ce8a6e24802 Mon Sep 17 00:00:00 2001 From: H0ngJu Date: Sun, 7 Apr 2024 11:28:50 +0900 Subject: [PATCH] 2024-04-07 --- H0ngJu/README.md | 19 ++++---- ...4\355\203\225 \352\262\214\354\236\204.py" | 44 +++++++++++++++++++ 2 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 "H0ngJu/\352\265\254\355\230\204/\354\202\254\355\203\225 \352\262\214\354\236\204.py" diff --git a/H0ngJu/README.md b/H0ngJu/README.md index eea8f055..3bfb00f2 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -1,13 +1,14 @@ ## ✏️ 기록 -| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | -| :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :-------------------------------------------------: | -| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | -| 2차시 | 2024.03.07 | 큐 | [다리를 지나는 트럭](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 | -| 3차시 | 2024.03.10 | 힙 | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 | -| 4차시 | 2024.03.13 | 힙 | [문제집](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 | -| 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 | +| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | +| :----: | :--------: | :------: | :-----------------------------------------------------------------------------------: | :-------------------------------------------------: | +| 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | +| 2차시 | 2024.03.07 | 큐 | [다리를 지나는 트럭](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 | +| 3차시 | 2024.03.10 | 힙 | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 | +| 4차시 | 2024.03.13 | 힙 | [문제집](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 | +| 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 | +| 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