Skip to content

Commit

Permalink
2024-04-07
Browse files Browse the repository at this point in the history
  • Loading branch information
H0ngJu committed Apr 7, 2024
1 parent 91b36eb commit 27c0798
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
19 changes: 10 additions & 9 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
@@ -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 |

---
44 changes: 44 additions & 0 deletions H0ngJu/κ΅¬ν˜„/사탕 κ²Œμž„.py
Original file line number Diff line number Diff line change
@@ -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<N and 0<=y<N:
data[i][k], data[x][y] = data[x][y], data[i][k]
cnt = max(cnt, eat(x,y))
data[i][k], data[x][y] = data[x][y], data[i][k] #λ‹€μ‹œ 되돌리기

print(cnt)

0 comments on commit 27c0798

Please sign in to comment.