結果

問題 No.582 キャンディー・ボックス3
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-28 09:42:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 2,335 ms
コンパイル使用メモリ 74,208 KB
実行使用メモリ 41,756 KB
最終ジャッジ日時 2024-05-01 20:32:44
合計ジャッジ時間 5,631 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 129 ms
41,140 KB
testcase_02 AC 128 ms
41,032 KB
testcase_03 AC 125 ms
41,324 KB
testcase_04 AC 126 ms
41,136 KB
testcase_05 AC 124 ms
41,120 KB
testcase_06 AC 128 ms
41,376 KB
testcase_07 AC 125 ms
41,344 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 124 ms
41,276 KB
testcase_11 AC 128 ms
41,756 KB
testcase_12 AC 117 ms
41,448 KB
testcase_13 AC 139 ms
41,648 KB
testcase_14 AC 133 ms
41,440 KB
testcase_15 AC 148 ms
41,396 KB
testcase_16 WA -
testcase_17 AC 141 ms
41,568 KB
testcase_18 AC 144 ms
41,432 KB
testcase_19 AC 139 ms
41,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] c = new int[n];
		for(int i = 0 ; i < n ; i++) {
			c[i] = sc.nextInt();
		}
		int odd = 0, even = 0;
		for(int i = 0 ; i < n ; i++) {
			if(c[i] >= 3) {
				System.out.println("B");
				return;
			}
			if(c[i] == 0) even++;
			else if(c[i] == 1) odd++;
		}
		if(odd % 2 == 1 && even == 0 || odd % 2 == 0 && even == 1) {
			System.out.println("A");
		} else {
			System.out.println("B");
		}
 	}
}
0