結果

問題 No.1129 Rating じゃんけん
ユーザー Takuya Noguchi
提出日時 2021-06-24 20:56:13
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 443 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 45 ms
コンパイル使用メモリ 9,216 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2026-03-11 16:07:41
合計ジャッジ時間 1,760 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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