From 36b71e1582226dfd7daf2f455f8eb4b9a6625c76 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Sun, 24 Aug 2025 23:25:05 +0900 Subject: [PATCH] =?UTF-8?q?[20250824]=20BOJ=20/=20G4=20/=20=EB=81=9D?= =?UTF-8?q?=EB=82=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=ED=8C=8C=ED=8B=B0=20?= =?UTF-8?q?/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\353\212\224 \355\214\214\355\213\260.md" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 "suyeun84/202508/24 BOJ G4 \353\201\235\353\202\230\354\247\200 \354\225\212\353\212\224 \355\214\214\355\213\260.md" diff --git "a/suyeun84/202508/24 BOJ G4 \353\201\235\353\202\230\354\247\200 \354\225\212\353\212\224 \355\214\214\355\213\260.md" "b/suyeun84/202508/24 BOJ G4 \353\201\235\353\202\230\354\247\200 \354\225\212\353\212\224 \355\214\214\355\213\260.md" new file mode 100644 index 00000000..88ffb046 --- /dev/null +++ "b/suyeun84/202508/24 BOJ G4 \353\201\235\353\202\230\354\247\200 \354\225\212\353\212\224 \355\214\214\355\213\260.md" @@ -0,0 +1,44 @@ +```java +import java.io.*; +import java.util.*; + +public class boj11265 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static StringBuilder sb = new StringBuilder(); + + public static void main(String[] args) throws Exception { + nextLine(); + int N = nextInt(); + int M = nextInt(); + int[][] cost = new int[N+1][N+1]; + for (int i = 1; i < N+1; i++) { + nextLine(); + for(int j = 1; j < N+1; j++){ + cost[i][j] = nextInt(); + } + } + for(int middle = 1; middle < N+1; middle++){ + for(int start = 1; start < N+1; start++){ + for(int end = 1; end < N+1; end++){ + cost[start][end] = Math.min(cost[start][end], cost[start][middle]+cost[middle][end]); + } + } + } + for (int i = 0; i < M; i++) { + nextLine(); + int a = nextInt(); + int b = nextInt(); + long c = Long.parseLong(st.nextToken()); + if(cost[a][b] <= c) { + sb.append("Enjoy other party").append("\n"); + } else { + sb.append("Stay here").append("\n"); + } + } + System.out.println(sb); + } +} +```