結果

問題 No.998 Four Integers
ユーザー megane_anko
提出日時 2021-03-07 00:44:30
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 640 bytes
コンパイル時間 8,552 ms
コンパイル使用メモリ 229,148 KB
実行使用メモリ 39,680 KB
最終ジャッジ日時 2024-12-31 16:32:38
合計ジャッジ時間 10,822 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from 'fs';
const input = fs.readFileSync('/dev/stdin', 'utf8');

const ABCDarray = input.split(' ');
let nABCDarray = [];
nABCDarray = ABCDarray.map(Number);
const A = nABCDarray[0];
const B = nABCDarray[1];
const C = nABCDarray[2];
const D = nABCDarray[3];

nABCDarray.sort(
    function (a, b) {
        if (a < b) return -1;
        if (a > b) return 1;
        return 0;
    }
);
//console.log(nABCDarray);

const a = nABCDarray[0];
const b = nABCDarray[1];
const c = nABCDarray[2];
const d = nABCDarray[3];

if ((a + 1 === b) && (b + 1 === c) && (c + 1 === d)) {
    console.log('Yes');
} else {
    console.log('No');
}
0