297. Add Two Matrices
EasyMatrix
Print the sum of two r×c matrices.
Input format
Line 1: r c Next r lines: matrix A Next r lines: matrix B
Output format
r lines of c integers.
Example 1
Input
2 2 1 2 3 4 5 6 7 8
Output
6 8 10 12
Example 2
Input
1 3 1 1 1 -1 0 1
Output
0 1 2
Constraints
1 ≤ r, c ≤ 500
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…