본문 바로가기

알고리즘

maxofarr

 

 

import java.util.Scanner;
public class Main{
    public static int[][] arr = new int[20][20];
    public static void main(String[] args){

      Scanner scan = new Scanner(System.in);
      
      inputMap(scan);
      
      int max=-1;int x=0;int y=0;
      
      for(int i=1;i<=9;i++)
      {
        for(int j=1;j<=9;j++)
        {
          if(arr[i][j]>max)
          {
            max=arr[i][j];
            x=i;y=j;
          }
        }
      }
      System.out.println(max);
      System.out.println(x+" "+y);
      
      scan.close();
    }
    
    public static void inputMap(Scanner scan)
    {
      for(int i=1;i<=9;i++)
      {
        for(int j=1;j<=9;j++)
        {
          arr[i][j] = scan.nextInt();
        }
      }
    }
}

'알고리즘' 카테고리의 다른 글

직사각형배치경우의수  (0) 2019.08.02
rook  (0) 2019.08.02
행렬뒤집기  (0) 2019.08.01
상자색 칠하기  (0) 2019.08.01
inequal  (0) 2019.08.01