結果

問題 No.998 Four Integers
ユーザー T AT A
提出日時 2020-07-25 17:11:31
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 526 bytes
コンパイル時間 7,966 ms
コンパイル使用メモリ 228,308 KB
実行使用メモリ 42,552 KB
最終ジャッジ日時 2024-12-31 16:16:16
合計ジャッジ時間 10,732 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const input: string = lines[0]
  const arr: number[] = input.split(' ').map(str => parseInt(str, 10))
  const sortArr = arr.sort((a, b) => a - b)
  if (sortArr[1] - sortArr[0] === 1 && sortArr[2] - sortArr[1] === 1 && sortArr[3] - sortArr[2] === 1) {
    console.log('Yes');
  }else{
    console.log('No');
  }



});
0