[백준] 2738번 문제, 행렬 덧셈
문제
여기를 눌러 문제를 확인하세요.
코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import sys
IN = sys.stdin.readline
if __name__ == "__main__":
N, M = map(int, IN().split())
A, B = [list(map(int, IN().split())) for _ in range(N)], [list(map(int, IN().split())) for _ in range(N)]
result = [[0 for _ in range(M)] for _ in range(N)]
for r in range(N):
for c in range(M):
result[r][c] = A[r][c] + B[r][c]
for arr in result:
print(*arr)