結果
| 問題 | No.1129 Rating じゃんけん |
| ユーザー |
|
| 提出日時 | 2022-05-02 20:53:24 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| + 652µs | |
| コード長 | 559 bytes |
| 記録 | |
| コンパイル時間 | 9 ms |
| コンパイル使用メモリ | 8,576 KB |
| 実行使用メモリ | 14,464 KB |
| 最終ジャッジ日時 | 2026-08-03 16:21:03 |
| 合計ジャッジ時間 | 2,295 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
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)
if a != c
if a > c
'null'
else
'tRue'
end
elsif b != d
if self.win?(b, d)
'null'
else
'tRue'
end
else
'Draw'
end
end
end
puts RockPaperScissors.winner