diff --git "a/Seol-JY/202511/22 BOJ G5 \352\271\200\353\260\245\354\262\234\352\265\255\354\235\230 \352\263\204\353\213\250.md\342\200\216" "b/Seol-JY/202511/22 BOJ G5 \352\271\200\353\260\245\354\262\234\352\265\255\354\235\230 \352\263\204\353\213\250.md\342\200\216" new file mode 100644 index 00000000..f4aa3155 --- /dev/null +++ "b/Seol-JY/202511/22 BOJ G5 \352\271\200\353\260\245\354\262\234\352\265\255\354\235\230 \352\263\204\353\213\250.md\342\200\216" @@ -0,0 +1,45 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + int N = Integer.parseInt(st.nextToken()); + int K = Integer.parseInt(st.nextToken()); + + int[] dist = new int[N + 1]; + Arrays.fill(dist, -1); + + ArrayDeque queue = new ArrayDeque<>(); + queue.offer(0); + dist[0] = 0; + + while (!queue.isEmpty()) { + int cur = queue.poll(); + + if (dist[cur] >= K) continue; + + int next1 = cur + 1; + if (next1 <= N && dist[next1] == -1) { + dist[next1] = dist[cur] + 1; + queue.offer(next1); + } + + int next2 = cur + cur / 2; + if (next2 <= N && dist[next2] == -1) { + dist[next2] = dist[cur] + 1; + queue.offer(next2); + } + } + + if (dist[N] != -1 && dist[N] <= K) { + System.out.println("minigimbob"); + } else { + System.out.println("water"); + } + } +} +```