본문 바로가기
python-algorithm

2167 2차원 배열의 합

by 무적김두칠 2021. 11. 12.

1
2
3
4
5
6
7
8
9
10
11
12
n,m=map(int, (input().split()))
list_1 = []
for i in range(n):
    list_1.append(list(map(int, input().split())))
k=int(input())
for i in range(k):
    a,b,c,d=map(int,input().split())
    ans=0
    for j in range(a-1,c):
        for k in range(b-1,d):
            ans+=list_1[j][k]
    print(ans)
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 9288 More Dice  (0) 2021.11.19
백준 6975 Deficient, Perfect, and Abundant  (0) 2021.11.12
백준 2738 행렬 덧셈  (0) 2021.11.12
Hacker rank Print the Elements of a Linked List  (0) 2021.11.12
백준 2745 진법 변환  (0) 2021.11.02

댓글