結果
| 問題 |
No.24 数当てゲーム
|
| ユーザー |
|
| 提出日時 | 2019-04-11 11:35:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 659 bytes |
| コンパイル時間 | 440 ms |
| コンパイル使用メモリ | 66,264 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 09:02:00 |
| 合計ジャッジ時間 | 889 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:37:13: warning: 'sub' may be used uninitialized [-Wmaybe-uninitialized]
37 | cout << sub << endl;
| ^~~
main.cpp:13:9: note: 'sub' was declared here
13 | int sub;
| ^~~
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
int a[10][4];
string s[10];
int cnt[10] = {};
int max = 0;
int sub;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3] >> s[i];
}
for (int i = 0; i < n; i++) {
if (s[i] == "YES") {
cnt[a[i][0]]++;
cnt[a[i][1]]++;
cnt[a[i][2]]++;
cnt[a[i][3]]++;
}
}
for (int i = 0; i < 9; i++) {
if (cnt[i] > max) {
max = cnt[i];
sub = i;
}
}
cout << sub << endl;
}