結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2017-01-11 12:10:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 16 ms / 5,000 ms |
コード長 | 280 bytes |
コンパイル時間 | 1,306 ms |
コンパイル使用メモリ | 158,760 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 08:07:59 |
合計ジャッジ時間 | 2,270 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:15: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 19 | cout<<ans<<endl; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N,L,max=0,ans; cin>>N; int hist[7]; fill(hist,hist+7,0); for(int i=0;i<N;i++){ cin>>L; hist[L]++; } for(int i=1;i<7;i++){ if(max<=hist[i]){ ans=i; max=hist[i]; } } cout<<ans<<endl; return 0; }