結果

問題 No.1129 Rating じゃんけん
ユーザー Takuya Noguchi
提出日時 2021-06-24 20:56:13
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 52 ms / 2,000 ms
+ 177µs
コード長 443 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2026-07-29 17:29:54
合計ジャッジ時間 2,182 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

null_rate, null_hand, tRue_rate, tRue_hand = gets.split.map(&:to_i)

def winner(n_hand, t_hand)
  return 'Draw' if n_hand == t_hand

  return 'null' if n_hand == 0 && t_hand == 1 || n_hand == 1 && t_hand == 2 || n_hand == 2 && t_hand == 0

  'tRue'
end

if null_rate == tRue_rate
  puts winner(null_hand, tRue_hand)
else
  if null_rate == tRue_rate
    puts 'Draw'
  elsif null_rate > tRue_rate
    puts 'null'
  else
    puts 'tRue'
  end
end
0