結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー Syuutaro
提出日時 2018-03-14 23:31:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 08:26:02
合計ジャッジ時間 1,238 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&L[i]);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int N;
int main(){
    //iuput
    scanf("%d",&N);

    int L[N];
    for (int i = 0;i < N;i++){
        scanf("%d",&L[i]);
    }

    //count
    int C[6] = {0,0,0,0,0,0};
    for (int i = 0;i < N;i++){
        C[L[i]-1]++;
    }

    int max = -1;
    int level = -1;
    for (int i = 0;i < 6;i++){
        if (max <= C[i]){
            max = C[i];
            level = i+1;
        }
    }

    //output
    printf("%d\n",level);
    return 0;
}
0