

-Code
import java.io.*;
import java.util.*;
public class BOJ2566 {
public static void main(String[] args) throws Exception {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
// 배열 입력값으로 초기화
int[][] arr = new int[9][9];
for (int row = 0; row < 9; row++) {
StringTokenizer st = new StringTokenizer(br.readLine());
for (int col = 0; col < 9; col++) {
arr[row][col] = Integer.parseInt(st.nextToken());
}
}
int maxVal = Integer.MIN_VALUE;
int resRow = 0, resCol = 0;
// 최대값 구하는 로직
for (int row = 0; row < 9; row++) {
for (int col = 0; col < 9; col++) {
int now = arr[row][col];
if (now > maxVal) {
maxVal = now;
resRow = row + 1;
resCol = col + 1;
}
}
}
System.out.println(maxVal);
System.out.println(resRow + " " + resCol);
}
}
'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 2563번 색종이 (0) | 2025.12.20 |
|---|---|
| [백준/Java] 10798번 세로읽기 (0) | 2025.12.20 |
| [백준/Java] 2738번 행렬 덧셈 (0) | 2025.12.20 |
| [백준/Java] 25206번 너의 평점은 (0) | 2025.12.20 |
| [백준/Java] 1316번 그룹 단어 체커 (0) | 2025.12.20 |