結果

問題 No.99 ジャンピング駒
ユーザー mizzsig
提出日時 2017-05-13 22:52:22
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 760 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 55,128 KB
最終ジャッジ日時 2024-10-13 00:08:15
合計ジャッジ時間 1,820 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

let inputs = ``;

process.stdin.on('data', function (chunk) {
    inputs += chunk;
});

process.stdin.on('end', function () {
    let input = inputs.split("\n");
    let input2 = input[1].split(" ");
    
    input[0] = parseInt(input[0]);
    for(let i = 0; i < input[0]; i++){
        input2[i] = parseInt(input2[i]);
    }

    for(let value of input2){
        value = parseInt(value);
    }
    
    let even = 0;
    let odd = 0;
    
    for(let i = 0; i < input[0]; i++){
        if(input2[i] % 2 == 0){
            even++;
        }else{
            odd++;
        }
    }
    
    let ans = () => {
        if(even > odd){
            return even - odd;
        }else{
            return odd - even;
        }
    };
    
    console.log(ans());
});
0