From ed8496f735c316458293a09abf3781687d1bc97a Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Wed, 5 Feb 2025 14:37:51 +0900 Subject: [PATCH] =?UTF-8?q?[20250205]=20BOJ=20/=20=EA=B3=A8=EB=93=9C2=20/?= =?UTF-8?q?=20=EB=93=B1=EC=82=B0=20/=20=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\223\2342 \353\223\261\354\202\260.md" | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 "lkhyun/202502/05 BOJ \352\263\250\353\223\2342 \353\223\261\354\202\260.md" diff --git "a/lkhyun/202502/05 BOJ \352\263\250\353\223\2342 \353\223\261\354\202\260.md" "b/lkhyun/202502/05 BOJ \352\263\250\353\223\2342 \353\223\261\354\202\260.md" new file mode 100644 index 00000000..e3dbd2de --- /dev/null +++ "b/lkhyun/202502/05 BOJ \352\263\250\353\223\2342 \353\223\261\354\202\260.md" @@ -0,0 +1,90 @@ +```java +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.*; + +public class Main { + static BufferedReader br; + static BufferedWriter bw; + public static void main(String[] args) throws Exception { + br = new BufferedReader(new InputStreamReader(System.in)); + bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringTokenizer st = new StringTokenizer(br.readLine()); + int N = Integer.parseInt(st.nextToken()); + int M = Integer.parseInt(st.nextToken()); + int T = Integer.parseInt(st.nextToken()); + int D = Integer.parseInt(st.nextToken()); + + int[][] map = new int[N][M]; + for(int n=0;n=97 && c<=122){ + map[n][temp++] = c-'a' + 26; + } + else{ + map[n][temp++] += c-'A'; + } + } + } + + long[][] shortpath = new long[N*M][N*M]; + for(int i=0;i= 0 && newi < N && newj >= 0 && newj < M){ + int height = map[newi][newj] - map[i][j]; + if(Math.abs((double)height) > T){continue;} + if(height >= 0){//높은 곳에서 아래로 이동 + shortpath[newi*M+newj][i*M+j] = 1; + shortpath[i*M+j][newi*M+newj] = (int)Math.pow(height,2); + } + else{ + shortpath[newi*M+newj][i*M+j] = (int)Math.pow(height,2); + shortpath[i*M+j][newi*M+newj] = 1; + } + + } + } + } + } + for(int x=0;x