結果
| 問題 |
No.79 過小評価ダメ・ゼッタイ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-14 16:56:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 307 bytes |
| コンパイル時間 | 716 ms |
| コンパイル使用メモリ | 63,360 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 06:59:36 |
| 合計ジャッジ時間 | 1,881 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:18:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
18 | cout << ans << endl;
| ^~~
main.cpp:5:13: note: 'ans' was declared here
5 | int n, t, ans, Max = 0;
| ^~~
ソースコード
#include <iostream>
using namespace std;
int main() {
int n, t, ans, Max = 0;
int L[7] = {};
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
L[t]++;
}
for (int i = 1; i <= 6; i++) {
if (Max <= L[i]) {
Max = L[i];
ans = i;
}
}
cout << ans << endl;
return 0;
}