結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
tntan
|
| 提出日時 | 2015-12-14 20:19:04 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 5,000 ms |
| コード長 | 363 bytes |
| 記録 | |
| コンパイル時間 | 379 ms |
| コンパイル使用メモリ | 85,556 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-12 23:43:19 |
| 合計ジャッジ時間 | 1,229 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:26:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
26 | cout << ans << endl;
| ^~~
main.cpp:17:23: note: 'ans' was declared here
17 | int MAX = -1, ans;
| ^~~
ソースコード
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <vector>
using namespace std;
int main()
{
int n, a, t[7] = {};
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a;
t[a]++;
}
int MAX = -1, ans;
for (int i = 1; i <= 6; i++)
{
if (MAX <= t[i])
{
ans = i;
MAX = t[i];
}
}
cout << ans << endl;
return 0;
}
tntan