結果

問題 No.582 キャンディー・ボックス3
ユーザー 37zigen
提出日時 2020-03-19 02:21:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 74,744 KB
実行使用メモリ 54,668 KB
最終ジャッジ日時 2024-12-14 02:55:31
合計ジャッジ時間 5,543 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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