結果

問題 No.582 キャンディー・ボックス3
ユーザー GrenacheGrenache
提出日時 2017-10-27 22:55:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 3,717 ms
コンパイル使用メモリ 78,008 KB
実行使用メモリ 42,044 KB
最終ジャッジ日時 2024-05-01 17:09:50
合計ジャッジ時間 7,497 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
41,120 KB
testcase_01 AC 140 ms
41,192 KB
testcase_02 AC 141 ms
41,284 KB
testcase_03 AC 139 ms
40,972 KB
testcase_04 AC 138 ms
41,176 KB
testcase_05 AC 139 ms
41,360 KB
testcase_06 WA -
testcase_07 AC 138 ms
41,216 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 138 ms
40,924 KB
testcase_11 AC 141 ms
41,332 KB
testcase_12 AC 142 ms
41,188 KB
testcase_13 AC 146 ms
41,076 KB
testcase_14 AC 148 ms
41,332 KB
testcase_15 AC 154 ms
41,356 KB
testcase_16 WA -
testcase_17 AC 157 ms
41,288 KB
testcase_18 AC 154 ms
41,456 KB
testcase_19 AC 153 ms
41,420 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 max = 0;
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			if (c[i] == 1) {
				cnt++;
			}
			max = Math.max(max, c[i]);
		}

		if (n == 1) {
			pr.println('B');
		} else {
			if (n == cnt && n % 2 == 1) {
				pr.println('A');
			} else if (n == cnt + 1 && max == 2 && cnt % 2 == 1) {
				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