結果
| 問題 |
No.79 過小評価ダメ・ゼッタイ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-28 01:05:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 5,000 ms |
| コード長 | 527 bytes |
| コンパイル時間 | 594 ms |
| コンパイル使用メモリ | 73,004 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 07:14:49 |
| 合計ジャッジ時間 | 1,598 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:21: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
29 | cout << ans+1 << endl;
| ^
ソースコード
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
#define rep(i,x) for(int i=0;i<(int)(x);i++)
int main(){
int n, m, ans, max = 0, l[6] = { 0 };
cin >> n;
rep(i, n) {
cin >> m;
++l[m-1];
}
rep(i,6) {
if (l[i] >= max) {
max = l[i];
ans = i;
}
}
cout << ans+1 << endl;
return 0;
}