-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathDay11:2DArrays.java
More file actions
27 lines (25 loc) 路 698 Bytes
/
Copy pathDay11:2DArrays.java
File metadata and controls
27 lines (25 loc) 路 698 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 max=-64;
for(int i=0;i<=3;i++){
for(int j=0;j<=3;j++){
int sum=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(sum>max)
max=sum;
}
}
System.out.println(max);
}
}