Skip to content

Commit 45f830f

Browse files
committed
[백준 9655] 돌 게임 - dp
1 parent 0370aec commit 45f830f

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+
import java.io.IOException;
2+
3+
public class Main {
4+
private static int N;
5+
private static String answer;
6+
7+
public static void main(String[] args) throws Exception {
8+
input();
9+
10+
answer = solution();
11+
12+
output();
13+
}
14+
15+
private static String solution() {
16+
int pick3StoneTurn = N / 3;
17+
int pick1StoneTurn = N % 3;
18+
19+
if ((pick3StoneTurn % 2 == 0 && pick1StoneTurn % 2 == 1)
20+
|| (pick3StoneTurn % 2 == 1 && pick1StoneTurn % 2 == 0)) {
21+
return "SK";
22+
}
23+
24+
return "CY";
25+
}
26+
27+
private static void input() throws Exception {
28+
N = readInt();
29+
}
30+
31+
private static void output() {
32+
System.out.println(answer);
33+
}
34+
35+
static int readInt() throws IOException {
36+
int val = 0;
37+
boolean negative = false;
38+
39+
while (true) {
40+
int c = System.in.read();
41+
if (c == ' ' || c == '\n' || c == -1) {
42+
break;
43+
}
44+
if (c == '-') {
45+
negative = true;
46+
continue;
47+
}
48+
val = 10 * val + c - 48;
49+
}
50+
51+
return negative ? -val : val;
52+
}
53+
}
54+

0 commit comments

Comments
 (0)