Skip to content

Commit 71cfeb5

Browse files
authored
[20250311] BOJ / P3 / 채석장 게임 / 권혁준
1 parent 1cb230f commit 71cfeb5

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
```java
2+
3+
import java.util.*;
4+
import java.io.*;
5+
6+
7+
class Main {
8+
9+
// IO field
10+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
12+
static StringTokenizer st;
13+
14+
static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
15+
static int nextInt() {return Integer.parseInt(st.nextToken());}
16+
static long nextLong() {return Long.parseLong(st.nextToken());}
17+
static void bwEnd() throws Exception {bw.flush();bw.close();}
18+
19+
// Additional field
20+
21+
static int N;
22+
static long[] X, M;
23+
24+
static long f(long x) {
25+
if(x%4 == 0) return x;
26+
if(x%4 == 1) return 1;
27+
if(x%4 == 2) return x+1;
28+
return 0;
29+
}
30+
31+
public static void main(String[] args) throws Exception {
32+
33+
ready();
34+
solve();
35+
36+
bwEnd();
37+
38+
}
39+
40+
static void ready() throws Exception{
41+
42+
N = Integer.parseInt(br.readLine());
43+
X = new long[N];
44+
M = new long[N];
45+
for(int i=0;i<N;i++) {
46+
nextLine();
47+
X[i] = nextLong();
48+
M[i] = nextLong();
49+
}
50+
51+
}
52+
53+
static void solve() throws Exception{
54+
55+
long res = 0;
56+
for(int i=0;i<N;i++) {
57+
long x = X[i], m = M[i];
58+
res ^= f(x-1) ^ f(x+m-1);
59+
}
60+
bw.write(res==0 ? "cubelover" : "koosaga");
61+
62+
}
63+
64+
}
65+
66+
```

0 commit comments

Comments
 (0)