結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
![]() |
提出日時 | 2015-12-14 20:19:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 17 ms / 5,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 560 ms |
コンパイル使用メモリ | 66,876 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 07:45:40 |
合計ジャッジ時間 | 1,558 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 26 | cout << ans << endl; | ^~~
ソースコード
#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; }