Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- static int[][] map;
- static int[][] dp;
- static int N;
- static int M;
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int T;
- T = sc.nextInt();
- for(int i=0;i<T;i++){
- N = sc.nextInt();
- M = sc.nextInt();
- map = new int[N+1][N+1];
- dp = new int[N][N];
- for(int j=0;j<N;j++){
- for(int k=0;k<N;k++){
- map[j][k] = sc.nextInt();
- }
- }
- int max =0;
- for(int n=0;n<N-1;n++){
- for(int m=0;m<N-1;m++){
- dp[n][m] = map[n][m]+map[n][m+1]+map[n+1][m]+map[n+1][m+1];
- if(dp[n][m]>max)
- max = dp[n][m];
- }
- }
- System.out.println(max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement