Skip to content

Commit 92e852c

Browse files
authored
[20251122] BOJ / G5 / 김밥천국의 계단 / 이종환
1 parent 1e12314 commit 92e852c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
```java
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
import java.util.ArrayList;
6+
import java.util.Arrays;
7+
import java.util.Collections;
8+
import java.util.HashMap;
9+
import java.util.HashSet;
10+
import java.util.LinkedList;
11+
import java.util.PriorityQueue;
12+
import java.util.Queue;
13+
import java.util.StringTokenizer;
14+
15+
public class Main {
16+
17+
static int[] dp = new int[1000_001];
18+
static int target, totalJump;
19+
static String ans = "water";
20+
21+
public static void main(String[] args) throws IOException {
22+
init();
23+
process();
24+
print();
25+
}
26+
27+
private static void init() throws IOException{
28+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
29+
StringTokenizer st = new StringTokenizer(br.readLine());
30+
target = Integer.parseInt(st.nextToken());
31+
totalJump = Integer.parseInt(st.nextToken());
32+
Arrays.fill(dp, Integer.MAX_VALUE);
33+
dp[0] = 0;
34+
}
35+
36+
private static void process() throws IOException {
37+
for (int i = 0; i < 1000_000; i++) {
38+
int next = i+1;
39+
int jump = i + i/2;
40+
dp[next] = Math.min(dp[next], dp[i]+1);
41+
if (jump <= 1000000) dp[jump] = Math.min(dp[jump], dp[i]+1);
42+
}
43+
44+
if (dp[target] <= totalJump) ans = "minigimbob";
45+
}
46+
47+
48+
49+
private static void print() {
50+
System.out.println(ans);
51+
}
52+
53+
}
54+
```

0 commit comments

Comments
 (0)