結果

問題 No.264 じゃんけん
ユーザー intercept6intercept6
提出日時 2020-07-30 15:24:06
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 610 bytes
コンパイル時間 8,920 ms
コンパイル使用メモリ 254,980 KB
実行使用メモリ 42,440 KB
最終ジャッジ日時 2023-09-17 04:33:31
合計ジャッジ時間 10,374 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,208 KB
testcase_01 AC 75 ms
42,440 KB
testcase_02 AC 76 ms
42,180 KB
testcase_03 AC 75 ms
42,348 KB
testcase_04 AC 75 ms
42,280 KB
testcase_05 AC 75 ms
42,208 KB
testcase_06 AC 76 ms
42,388 KB
testcase_07 AC 76 ms
42,244 KB
testcase_08 AC 77 ms
42,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import { readFileSync } from 'fs';

function Main(input: string): void {
  const data = input.split('\n');

  const firstLine = data[0].split(' ');

  const player1 = parseInt(firstLine[0]);
  const player2 = parseInt(firstLine[1]);

  if (player1 === player2) {
    console.log('Drew');
    return;
  }

  if (
    (player1 === 0 && player2 === 1) || // グー vs チョキ
    (player1 === 1 && player2 === 2) || // チョキ vs パー
    (player1 === 2 && player2 === 0) // パー vs グー
  ) {
    console.log('Won');
    return;
  }

  console.log('Lost');
}

Main(readFileSync('/dev/stdin', 'utf8'));
0