-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathJava2DArray.java
More file actions
27 lines (25 loc) · 707 Bytes
/
Copy pathJava2DArray.java
File metadata and controls
27 lines (25 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a[][] = new int[6][6];
for(int i=0; i < 6; i++){
for(int j=0; j < 6; j++){
a[i][j] = in.nextInt();
}
}
int sum=Integer.MIN_VALUE;
for(int i=0;i<=3;i++){
for(int j=0;j<=3;j++){
int s=a[i][j]+a[i][j+1]+a[i][j+2]+a[i+1][j+1]+a[i+2][j]+a[i+2][j+1]+a[i+2][j+2];
if(s>sum)
sum=s;
}
}
System.out.println(sum);
}
}