結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2017-01-11 12:10:42 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| コード長 | 280 bytes |
| 記録 | |
| コンパイル時間 | 910 ms |
| コンパイル使用メモリ | 174,596 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-13 00:03:29 |
| 合計ジャッジ時間 | 1,734 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:15: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
19 | cout<<ans<<endl;
| ^~~
main.cpp:5:23: note: 'ans' was declared here
5 | int N,L,max=0,ans;
| ^~~
ソースコード
#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;
}
dnish