結果

問題 No.998 Four Integers
ユーザー nzn-m
提出日時 2020-03-21 21:26:15
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 75 ms / 1,000 ms
コード長 573 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 6,692 KB
実行使用メモリ 42,552 KB
最終ジャッジ日時 2024-10-13 01:36:13
合計ジャッジ時間 2,598 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

reader.on('line', (line) => {
    lines.push(line);
});

reader.on('close', () => {
    const arr = lines[0].split(' ').map(hoge=>parseInt(hoge, 10));
    var newArr = function(a, b){
        return a - b;
    }
    arr.sort(newArr);
    if(arr[3] - arr[2] == 1 && arr[2] - arr[1] == 1 && arr[1] - arr[0] == 1){
        console.log('Yes');
    } else {
        console.log('No');
    }
});
0