지나가던 개발자
[Python] 백준 2167번(2차원 배열의 합) 문제 풀이 본문
import sys
n, m = map(int,sys.stdin.readline().split())
array = []
for i in range(n):
array.append(list(map(int,sys.stdin.readline().split())))
for i in range(int(input())):
toSum = list(map(int,sys.stdin.readline().split()))
s = 0
for j in range(toSum[0]-1, toSum[2]):
for k in range(toSum[1]-1, toSum[3]):
s += array[j][k]
print(s)
시간초과 때문에 PyPy3로 제출해야 풀린다.
'PS > Python' 카테고리의 다른 글
[Python] 백준 2941번(크로아티아 알파벳) 문제 풀이 (0) | 2022.11.01 |
---|---|
[Python] 백준 5800번(성적 통계) 문제 풀이 (0) | 2022.10.31 |
[Python] 백준 15727번(조별과제를 하려는데 조장이 사라졌다) 문제 풀이 (0) | 2022.10.29 |
[Python] 백준 1032번(명령 프롬프트) 문제 풀이 (0) | 2022.10.28 |
[Python] 백준 2587번(대표값2) 문제 풀이 (0) | 2022.10.27 |
Comments