結果

問題 No.79 過小評価ダメ・ゼッタイ
コンテスト
ユーザー focus
提出日時 2018-01-24 00:54:57
言語 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
結果
WA  
実行時間 -
コード長 335 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 546 ms
コンパイル使用メモリ 86,400 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-31 22:57:34
合計ジャッジ時間 1,657 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 8 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:17:13:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:175:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
  175 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:8:32: note: 'ans' was declared here
    8 |     long 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(){
    long 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;
    }
    cout << ans;
    return 0;
}
0