격자판 의 합
java - 격자판 최대합 (배열)
java - 격자판 최대합 (배열)
2021.07.25import java.util.Scanner; public class SumOfGrating { public static int solution(int n, int[][] grating) { int answer = Integer.MIN_VALUE; int sumRow, sumCol; for (int i = 0; i < n; i++) { sumRow=sumCol=0; for (int j = 0; j < n; j++) { sumRow += grating[i][j]; sumCol += grating[j][i]; } answer = Math.max(answer, sumRow); answer = Math.max(answer, sumCol); } int diagonalSum = 0, reverseDiagonalSu..