結果

問題 No.1129 Rating じゃんけん
ユーザー hogucchogucc
提出日時 2022-05-02 21:07:54
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-14 18:12:52
合計ジャッジ時間 3,561 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,316 KB
testcase_01 AC 81 ms
15,148 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 82 ms
15,140 KB
testcase_05 AC 81 ms
15,172 KB
testcase_06 AC 81 ms
15,284 KB
testcase_07 AC 81 ms
15,308 KB
testcase_08 AC 81 ms
15,072 KB
testcase_09 AC 81 ms
15,140 KB
testcase_10 AC 82 ms
15,068 KB
testcase_11 AC 82 ms
15,324 KB
testcase_12 WA -
testcase_13 AC 81 ms
15,100 KB
testcase_14 AC 82 ms
15,304 KB
testcase_15 AC 82 ms
15,168 KB
testcase_16 AC 82 ms
15,108 KB
testcase_17 AC 82 ms
15,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class RockPaperScissors
  ROCK = 0
  Scissor = 1
  Paper = 2

  COMPATIBLE_TABLE = {ROCK => Scissor, Scissor => Paper, Paper => ROCK}

  def self.win?(player_hand, rival_hand)
    return false if COMPATIBLE_TABLE[player_hand] != rival_hand
    true
  end

  def self.winner
    a, b, c, d = gets.split.map(&:to_i)

    return 'null' if a > c
    return 'tRue' if c < a
    return 'null' if self.win?(b, d)
    return 'tRue' unless self.win?(b, d)
    'Draw'
  end
end

puts RockPaperScissors.winner
0