結果

問題 No.2813 Cookie
ユーザー ks2m
提出日時 2024-07-19 23:14:28
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 973 bytes
コンパイル時間 2,339 ms
コンパイル使用メモリ 76,360 KB
実行使用メモリ 46,324 KB
最終ジャッジ日時 2024-07-19 23:14:39
合計ジャッジ時間 9,052 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			int n = Integer.parseInt(br.readLine());
			String[] sa = br.readLine().split(" ");
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}

			int xor = 0;
			for (int i = 0; i < n; i++) {
				int ai = a[i];
				if (ai == 2) ai = 1;
				else if (ai == 3) ai = 2;
				else if (ai == 4) ai = 2;
				else if (ai == 5) ai = 4;
				else if (ai == 6) ai = 4;
				else if (ai == 7) ai = 6;
				else if (ai == 9) ai = 8;
				xor ^= ai;
			}
			if (xor == 0) {
				pw.println("Bob");
			} else {
				pw.println("Alice");
			}
		}
		pw.flush();
		br.close();
	}
}
0