結果

問題 No.998 Four Integers
コンテスト
ユーザー megane_anko
提出日時 2021-03-07 00:44:30
言語 TypeScript
(6.0.2)
コンパイル:
tsc.sh -p tsconfig.json
実行:
node main.js ONLINE_JUDGE
結果
AC  
実行時間 101 ms / 1,000 ms
コード長 640 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,871 ms
コンパイル使用メモリ 346,680 KB
実行使用メモリ 53,240 KB
最終ジャッジ日時 2026-06-05 05:27:47
合計ジャッジ時間 8,747 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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