結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー focus
提出日時 2018-01-24 00:53:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 62,840 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 03:56:55
合計ジャッジ時間 1,779 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 11 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:9: warning: ‘max’ is used uninitialized [-Wuninitialized]
   15 |         if(max<L[i])    ans=i;
      |         ^~
main.cpp:17:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |     cout << ans;
      |             ^~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
    int N,x,L[7]={},max,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