BackJoon Algorithm 최댓값 2566 (Java)

업데이트:
최대 1 분 소요

BackJoon Algorithm - Java

alt

문제

alt alt

풀이



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Back_2566 {
    public static void main(String[] args) throws IOException {

        //     given
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int max = 0;
        int arr[][] = new int[9][9];
        int row = 0;
        int col = 0;
        //    when
        for (int i = 0; i < 9; i++) {
            st = new StringTokenizer(br.readLine());
            for (int j = 0; j < 9; j++) {
                arr[i][j] = Integer.parseInt(st.nextToken());
                if (max < arr[i][j]) {
                    max = arr[i][j];
                    row = i;
                    col = j;
                }
            }
        }
        //    then
        System.out.println(max);
        System.out.println((row+1) + " " + (col+1));
        br.close();
    }
}

댓글남기기