📝 문제
🔓 답안
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[][] arr1 = new int[n][m];
int[][] arr2 = new int[n][m];
int i, j;
// 배열 2개 입력받기
for(i = 0; i < n; i++){
for(j = 0; j < m; j++){
arr1[i][j] = sc.nextInt();
}
}
for(i = 0; i < n; i++){
for(j = 0; j < m; j++){
arr2[i][j] = sc.nextInt();
}
}
// 출력
for(i = 0; i < n; i++){
for(j = 0; j < m; j++){
System.out.print(arr1[i][j] + arr2[i][j] + " ");
}
System.out.println();
}
sc.close();
}
}
'PS > Baekjoon' 카테고리의 다른 글
[Baekjoon] 18108 - 1998년생인 내가 태국에서는 2541년생?! (0) | 2022.11.13 |
---|---|
[Baekjoon] 2566 - 최댓값 (0) | 2022.11.12 |
[Baekjoon] 11659 - 구간 합 구하기 4 (0) | 2022.11.10 |
[Baekjoon] 11720 - 숫자의 합 (0) | 2022.11.09 |
[Baekjoon] 1546 - 평균 (0) | 2022.11.08 |
댓글