백준 문제풀이/Java
[백준] 2566번 최댓값
by isfp_yykkng
2024. 3. 22.
[백준] 2566번 최댓값 - 자바
문제
해설
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[][] matrix = new int[9][9];
int max = matrix[0][0];
int x = 1;
int y = 1;
for(int i=0; i<9;i++){
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
for(int j=0; j<9;j++){
matrix[i][j] = Integer.parseInt(st.nextToken());
}
}
for(int i=0; i<9;i++){
for(int j=0; j<9;j++){
if(matrix[i][j] > max){
max = matrix[i][j];
x = i + 1;
y = j + 1;
}
}
}
System.out.println(max + "\n" + x + " " + y);
}
}