From a377fda7526e09797e9969bcdd9fdaffe53a1d89 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Thu, 14 Aug 2025 19:29:13 +0900 Subject: [PATCH] =?UTF-8?q?[20250814]=20BOJ=20/=20G5=20/=20=EC=82=AC?= =?UTF-8?q?=EA=B3=BC=EB=82=98=EB=AC=B4=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...54\352\263\274\353\202\230\353\254\264.md" | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 "LiiNi-coder/202508/14 BOJ \354\202\254\352\263\274\353\202\230\353\254\264.md" diff --git "a/LiiNi-coder/202508/14 BOJ \354\202\254\352\263\274\353\202\230\353\254\264.md" "b/LiiNi-coder/202508/14 BOJ \354\202\254\352\263\274\353\202\230\353\254\264.md" new file mode 100644 index 00000000..1ff24b5a --- /dev/null +++ "b/LiiNi-coder/202508/14 BOJ \354\202\254\352\263\274\353\202\230\353\254\264.md" @@ -0,0 +1,64 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Arrays; + +public class Main { + private static BufferedReader br; + private static int N; + private static int[][] Map; + public static void main(String[] args) throws IOException { + br = new BufferedReader(new InputStreamReader(System.in)); + N = Integer.parseInt(br.readLine()); + Map = new int[N+1][N+1]; + for(int r = 1; r < N+1; r++){ + String[] temp = br.readLine().split(" "); + for(int c = 1; c= N+1 || rightDown[1] >= N+1){ + continue; + } + + int partitialSum; + if(n == 0){ + partitialSum = Map[r][c]; + }else{ + partitialSum= + preMap[rightDown[0]][rightDown[1]] + - preMap[rightDown[0] - (n+1)][rightDown[1]] + - preMap[rightDown[0]][rightDown[1] - (n+1)] + + preMap[r-1][c-1]; + } + answer = Math.max(answer, partitialSum); + //System.out.println(String.format("(r, c)=(%d, %d) (rd0, rd1)=(%d, %d), partitialSum: %d", r, c, rightDown[0], rightDown[1], partitialSum)); + } + } + } + System.out.println(answer); + } +} +```