結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
![]() |
提出日時 | 2018-01-24 00:58:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 17 ms / 5,000 ms |
コード長 | 374 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 63,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:22:32 |
合計ジャッジ時間 | 1,456 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:20:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] 20 | cout << ans; | ^~~
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstdio> #include<cmath> using namespace std; int main(){ int N,x,L[7]={},max=0,ans; cin >> N; for(int i=0;i<N;i++){ cin >> x; L[x]++; } for(int i=1;i<=6;i++){ if(max<=L[i]){ ans=i; max = L[i]; } } cout << ans; return 0; }