結果
| 問題 | No.582 キャンディー・ボックス3 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-26 22:34:56 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 321 ms |
| コンパイル使用メモリ | 73,600 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-25 13:57:23 |
| 合計ジャッジ時間 | 1,779 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:15:36: warning: 'count1' may be used uninitialized [-Wmaybe-uninitialized]
15 | if (buf == 1)count1++;
| ~~~~~~^~
main.cpp:8:15: note: 'count1' was declared here
8 | int n,count1,count2;
| ^~~~~~
ソースコード
#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;
}