File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+ import java.util.* ;
4+
5+ public class boj20002 {
6+ static BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
7+ static StringTokenizer st;
8+ static void nextLine () throws Exception { st = new StringTokenizer (br .readLine ()); }
9+ static int nextInt() { return Integer . parseInt(st. nextToken()); }
10+
11+ public static void main(String [] args) throws Exception {
12+ nextLine();
13+ int N = nextInt();
14+ int [][] arr = new int [N + 1 ][N + 1 ];
15+ int answer = - 1000 * 300 * 300 - 1 ;
16+ for (int i = 1 ; i <= N ; i++ ) {
17+ nextLine();
18+ for (int j = 1 ; j <= N ; j++ ) {
19+ int tmp = nextInt();
20+ arr[i][j] = tmp + arr[i- 1 ][j] + arr[i][j- 1 ] - arr[i- 1 ][j- 1 ];
21+ }
22+ }
23+ for (int k = 1 ; k <= N ; k++ ) {
24+ for (int i = k; i <= N ; i++ ) {
25+ for (int j = k; j <= N ; j++ ) {
26+ answer = Math . max(answer, arr[i][j] - arr[i][j- k] - arr[i- k][j] + arr[i- k][j- k]);
27+ }
28+ }
29+ }
30+ System . out. println(answer);
31+ }
32+ }
33+ ```
You can’t perform that action at this time.
0 commit comments