-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBus Game
More file actions
33 lines (27 loc) · 1.08 KB
/
Bus Game
File metadata and controls
33 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] s = br.readLine().split(" ");
long x = Long.parseLong(s[0]); // 100-yen coins
long y = Long.parseLong(s[1]); // 10-yen coins
boolean cielTurn = true;
while (true) {
boolean moved = false;
if (cielTurn) {
if (x >= 2 && y >= 2) { x -= 2; y -= 2; moved = true; }
else if (x >= 1 && y >= 12) { x -= 1; y -= 12; moved = true; }
else if (y >= 22) { y -= 22; moved = true; }
} else {
if (y >= 22) { y -= 22; moved = true; }
else if (x >= 1 && y >= 12) { x -= 1; y -= 12; moved = true; }
else if (x >= 2 && y >= 2) { x -= 2; y -= 2; moved = true; }
}
if (!moved) {
System.out.print(cielTurn ? "Hanako" : "Ciel");
return;
}
cielTurn = !cielTurn;
}
}
}