結果

問題 No.582 キャンディー・ボックス3
ユーザー GrenacheGrenache
提出日時 2017-10-27 23:31:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,012 bytes
コンパイル時間 3,806 ms
コンパイル使用メモリ 77,692 KB
実行使用メモリ 41,788 KB
最終ジャッジ日時 2024-05-01 17:50:49
合計ジャッジ時間 7,559 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,100 KB
testcase_01 AC 135 ms
41,184 KB
testcase_02 AC 133 ms
41,320 KB
testcase_03 AC 135 ms
41,552 KB
testcase_04 AC 135 ms
41,152 KB
testcase_05 AC 138 ms
41,368 KB
testcase_06 AC 123 ms
39,984 KB
testcase_07 AC 134 ms
41,296 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 124 ms
39,992 KB
testcase_11 WA -
testcase_12 AC 136 ms
41,004 KB
testcase_13 AC 144 ms
41,564 KB
testcase_14 AC 148 ms
41,400 KB
testcase_15 AC 146 ms
41,592 KB
testcase_16 WA -
testcase_17 AC 152 ms
41,400 KB
testcase_18 AC 149 ms
41,624 KB
testcase_19 AC 155 ms
41,568 KB
権限があれば一括ダウンロードができます

ソースコード

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 cnt = 0;
		int cnt2 = 0;
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			if (c[i] > 1) {
				cnt++;
			}
			if (c[i] == 2) {
				cnt2++;
			}
		}

		if (n == 1) {
			if (c[0] == 1) {
				pr.println('A');
			} else {
				pr.println('B');
			}
		} else {
			if (cnt > 1) {
				pr.println('B');
			} else if (cnt == 0 && n % 2 == 1) {
				pr.println('A');
			} else if (cnt == 1 && cnt2 == 1 && n % 2 == 0) {
				pr.println('A');
			} else {
				pr.println('B');
			}
		}
	}

	// ---------------------------------------------------
	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