백준/15001 - 20000
[백준] 18937번 : 왕들의 외나무다리 돌게임(JAVA)
lms0806
2021. 8. 11. 00:27
728x90
반응형
https://www.acmicpc.net/problem/18937
소스코드
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
StringTokenizer st = new StringTokenizer(br.readLine());
int n = 0;
while(st.hasMoreTokens()) {
n ^= (Integer.parseInt(st.nextToken()) - 2);
}
String s = br.readLine();
System.out.print(n != 0 ? s : s.equals("Whiteking") ? "Blackking" : "Whiteking");
}
}
728x90
반응형