結果

問題 No.582 キャンディー・ボックス3
ユーザー GBGB
提出日時 2018-11-26 22:34:56
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 57,480 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-11 15:57:06
合計ジャッジ時間 1,179 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 5 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:24: warning: ‘count1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |         if (count1 % 2 != 0 || count1 % 2 != 0 && count2 == 2)cout << 'A' << endl;
      |             ~~~~~~~~~~~^~~~

ソースコード

diff #

#include<iostream>
#include<vector>

using namespace std;

int main() {

	int n,count1,count2;
	cin >> n;
	vector<int> c;

	for (int i = 0;i < n;i++) {
		int buf;
		cin >> buf;
		if (buf == 1)count1++;
		else if (buf == 2)count2++;
	}
	if (count1 % 2 != 0 || count1 % 2 != 0 && count2 == 2)cout << 'A' << endl;
	else cout << 'B' << endl;
	
	return 0;
}
0