結果

問題 No.582 キャンディー・ボックス3
ユーザー 37zigen37zigen
提出日時 2020-03-19 02:21:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 71,408 KB
実行使用メモリ 55,980 KB
最終ジャッジ日時 2023-08-20 20:33:58
合計ジャッジ時間 5,675 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,560 KB
testcase_01 AC 126 ms
55,428 KB
testcase_02 AC 125 ms
53,188 KB
testcase_03 AC 126 ms
55,448 KB
testcase_04 AC 126 ms
55,792 KB
testcase_05 AC 126 ms
55,564 KB
testcase_06 AC 124 ms
55,692 KB
testcase_07 AC 128 ms
55,476 KB
testcase_08 AC 128 ms
55,764 KB
testcase_09 AC 127 ms
55,980 KB
testcase_10 AC 127 ms
55,784 KB
testcase_11 AC 128 ms
55,908 KB
testcase_12 AC 127 ms
53,568 KB
testcase_13 AC 135 ms
55,464 KB
testcase_14 AC 137 ms
55,504 KB
testcase_15 AC 141 ms
55,428 KB
testcase_16 AC 142 ms
55,412 KB
testcase_17 AC 141 ms
55,400 KB
testcase_18 AC 145 ms
55,672 KB
testcase_19 AC 143 ms
55,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] C=new int[n];
		int c1=0,c2=0,c=0;
		for(int i=0;i<n;++i) {
			C[i]=sc.nextInt();
			if(C[i]==1)++c1;
			else if(C[i]==2)++c2;
			else c+=C[i];
		}
		if(((c+c2)==0&&c1%2==1)||(c==0&&c2==1&&(c1+2*c2)%2==1)) {
			System.out.println("A");
		}else{
			System.out.println("B");
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0