結果

問題 No.264 じゃんけん
ユーザー yu0912
提出日時 2020-07-23 12:12:55
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 39,424 KB
最終ジャッジ日時 2024-06-23 17:28:39
合計ジャッジ時間 1,221 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

function main(input = '') {
  if (!input) throw Error;

  let lines = input.split('\n');
  let [me, you] = lines[0].split(' ').map((val) => parseInt(val));

  if (me === you) {
    return 'Drew';
  } else if (me - you === -1 || me - you === 2) {
    return 'Won';
  } else {
    return 'Lost';
  }
}

const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';

if (existsSync(stdin)) {
  const input = readFileSync(stdin, 'utf8');
  console.log(main(input));
}

module.exports = main;
0