結果

問題 No.582 キャンディー・ボックス3
ユーザー GrenacheGrenache
提出日時 2017-10-27 23:41:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 998 bytes
コンパイル時間 3,799 ms
コンパイル使用メモリ 78,148 KB
実行使用メモリ 41,808 KB
最終ジャッジ日時 2024-05-01 17:57:44
合計ジャッジ時間 6,357 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 110 ms
41,152 KB
testcase_04 AC 113 ms
41,060 KB
testcase_05 AC 106 ms
40,220 KB
testcase_06 AC 118 ms
41,032 KB
testcase_07 AC 113 ms
41,092 KB
testcase_08 AC 98 ms
40,204 KB
testcase_09 AC 114 ms
41,228 KB
testcase_10 AC 103 ms
40,280 KB
testcase_11 AC 119 ms
41,060 KB
testcase_12 WA -
testcase_13 AC 121 ms
41,512 KB
testcase_14 AC 131 ms
41,808 KB
testcase_15 AC 131 ms
41,104 KB
testcase_16 AC 131 ms
40,968 KB
testcase_17 AC 125 ms
41,176 KB
testcase_18 AC 131 ms
41,444 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder582 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int[] c = new int[n];
		int xor = 0;
		int cnt = 0;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			xor ^= c[i];
			if (c[i] > 0) {
				cnt++;
			}
			sum += c[i];
		}

		if (cnt == 1) {
			if (sum == 1) {
				pr.println('A');
			} else {
				pr.println('B');
			}
		} else {
			xor &= 0x3;

			if (xor == 0) {
				pr.println('B');
			} else if (xor == 1) {
				pr.println('A');
			} else if (xor == 2) {
				pr.println('B');
			} else {
				pr.println('A');
			}
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0