結果

問題 No.1314 N言っちゃダメゲーム (5)
ユーザー siman
提出日時 2022-09-13 18:35:12
言語 Ruby
(3.4.1)
結果
AC  
実行時間 88 ms / 1,000 ms
コード長 311 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-12-14 02:17:10
合計ジャッジ時間 3,947 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M, K = gets.split.map(&:to_i)

lose = (M - 1) / (K + 1)
win = (M - 1) - lose

w_cnt = Rational(win, 2).ceil

w_cnt += if win % 2 == 0
           0
         else
           lose
         end

if w_cnt > (M - 1) / 2
  puts 'Win'
elsif (M - 1) % 2 == 0 && w_cnt == (M - 1) / 2
  puts 'Draw'
else
  puts 'Lose'
end
0