結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー tetsuzuki1115
提出日時 2017-09-21 02:29:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 659 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 78,184 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:18:11
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:38:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   38 |     cout << ans << endl;
      |             ^~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int ans;
    int L[6] = {0};
    int N;
    cin >> N;
    for ( int i = 0; i < N; i++ ) {
        int l;
        cin >> l;
        l--;
        L[l]++;
    }
    int m = 0;
    for ( int i = 0; i < 6; i++ ) {
        if ( m <= L[i] ) {
            m = L[i];
            ans = i+1;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}
0