結果

問題 No.582 キャンディー・ボックス3
ユーザー Kainogi_Kainogi_
提出日時 2017-10-29 08:33:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 54,252 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-05-01 21:50:47
合計ジャッジ時間 997 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main() {
	int i, n, a, one, two, flag = 1;
	one = two = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a;

		if (a == 1)one++;
		else if (a == 2)two++;
		else if (a > 2)flag = 0;
		if ((two>1) || flag == 0) {
			flag = 0;
			break;
		}
	}

	if (flag == 1) {
		if (two == 0)if (one % 2==0)flag = 0;//2以上の数があるとき
		else if(two==1)if (one % 2==1)flag = 0;		
	}
	if (flag == 0)cout << "B" << endl;
	else cout << "A" << endl;
	return 0;
}
0