파리 퇴치
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
T = int(input())
for t in range(1, T+1):
N, M = map(int, input().split())
arr = []
# create map
for n in range(N):
arr.append(list(map(int, input().split())))
result = []
# 0 ~ N-1
for i in range(N-M+1):
for j in range(N-M+1):
mSum = 0
for mi in range(i, i+M):
for mj in range(j, j+M):
mSum += arr[mi][mj]
result.append(mSum)
print(f"#{t} {max(result)}")
728x90
'Algorithm&CodingTest > SW Expert Acardemy' 카테고리의 다른 글
[SWEA][D2] 1926 간단한 369게임 Python (0) | 2024.01.16 |
---|---|
[SWEA][D1] [2058] 자릿수 더하기 - Python (1) | 2023.05.16 |
[SWEA][D1] [2043] 서랍의 비밀번호 - Python (0) | 2023.05.16 |
[SWEA][D1] [2025] N줄 덧셈 - Python (0) | 2023.05.16 |
[SWEA] [2046] 스탬프 찍기 - python (0) | 2023.05.16 |