結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
41,320 KB
testcase_01 AC 128 ms
41,284 KB
testcase_02 AC 127 ms
41,356 KB
testcase_03 WA -
testcase_04 AC 130 ms
41,408 KB
testcase_05 AC 126 ms
41,540 KB
testcase_06 AC 124 ms
41,028 KB
testcase_07 AC 129 ms
41,360 KB
testcase_08 AC 125 ms
41,192 KB
testcase_09 WA -
testcase_10 AC 126 ms
41,728 KB
testcase_11 AC 130 ms
41,528 KB
testcase_12 AC 127 ms
41,184 KB
testcase_13 WA -
testcase_14 AC 135 ms
41,600 KB
testcase_15 WA -
testcase_16 AC 137 ms
41,280 KB
testcase_17 AC 139 ms
41,524 KB
testcase_18 AC 142 ms
41,680 KB
testcase_19 AC 146 ms
41,620 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] == 2) 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