Notice
Recent Posts
Recent Comments
Link
S E P H ' S
[Python] 2001 파리퇴치 본문
T = int(input())
for t in range(1, T+1):
N, M = map(int, input().split())
square = [list(map(int, input().split())) for _ in range(N)]
max_num = 0
for i in range(N-M+1):
for j in range(N-M+1):
cur = 0
for k in range(M):
for l in range(M):
cur += square[i+k][j+l]
if cur > max_num:
max_num = cur
print('#{} {}'.format(t, max_num))
'Algorithm > SWEA' 카테고리의 다른 글
[Java] SWEA 1248 공통조상 (0) | 2023.07.22 |
---|---|
[JAVA] SWEA 15758. 무한 문자열 D3 (0) | 2022.12.12 |
[Python] 11688. Calkin-Wilf tree 1 (0) | 2021.10.16 |