結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー ontama_12
提出日時 2016-09-23 18:10:37
言語 JavaScript
(node v23.5.0)
結果
RE  
実行時間 -
コード長 1,614 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 47,056 KB
最終ジャッジ日時 2024-10-12 23:47:32
合計ジャッジ時間 2,874 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 3 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

  ///////////////No.79 過小評価ダメ・ゼッタイ
    //入力文字読み取り
    process.stdin.resume();
    process.stdin.setEncoding('utf8');
    process.stdin.on('data', function (chunk) {

        //すべて受け取り改行で区切って格納
        var input = chunk.split("\n");
        
        //評価した人数
        var evaluationnumber = Number(input[0])
        //評価数字の一覧
        var evaluation = input[1].split(" ").map(Number)

        var one =0
        var two =0
        var three=0
        var four=0
        var five=0
        var six=0

        for (var i = 0; i < evaluation.length; i++) {
            if (evaluation[i] === 1) {
                one++
            }else if (evaluation[i] === 2) {
                two++
            }else  if (evaluation[i] === 3) {
                three++
            }else if (evaluation[i] === 4) {
                four++
            }else if (evaluation[i] === 5) {
                five++
            }else  if (evaluation[i] === 6) {
                six++
            }
        }
        //評価数が最も多い数字
        var max = Math.max(one, two, three, four, five, six);

        //同じ評価数のときはレベルの高い方順
        if (max == six) {
            console.log(6)
        } else if(max == five) {
            console.log(5)
        } else if (max == four) {
            console.log(4)
        }  else if (max == three) {
            console.log(3)
        } else if (max == two) {
            console.log(2)
        } else if (max == one) {
            console.log(1)
        }
    });
0