結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー focus
提出日時 2018-01-24 00:58:58
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 374 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 424 ms
コンパイル使用メモリ 86,252 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-13 00:17:44
合計ジャッジ時間 1,254 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   20 |     cout << ans;
      |             ^~~
main.cpp:8:27: note: 'ans' was declared here
    8 |     int N,x,L[7]={},max=0,ans;
      |                           ^~~

ソースコード

diff #
raw source code

#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;
}
0