結果

問題 No.1314 N言っちゃダメゲーム (5)
ユーザー simansiman
提出日時 2022-09-13 18:31:54
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 11,152 KB
実行使用メモリ 15,328 KB
最終ジャッジ日時 2023-08-20 20:04:04
合計ジャッジ時間 4,833 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,044 KB
testcase_01 AC 85 ms
15,124 KB
testcase_02 AC 82 ms
15,012 KB
testcase_03 AC 83 ms
15,004 KB
testcase_04 AC 83 ms
15,220 KB
testcase_05 AC 82 ms
15,016 KB
testcase_06 AC 84 ms
15,220 KB
testcase_07 AC 82 ms
15,276 KB
testcase_08 AC 81 ms
15,008 KB
testcase_09 AC 81 ms
15,232 KB
testcase_10 WA -
testcase_11 AC 82 ms
15,184 KB
testcase_12 AC 81 ms
15,148 KB
testcase_13 WA -
testcase_14 AC 82 ms
15,136 KB
testcase_15 AC 82 ms
15,012 KB
testcase_16 AC 83 ms
15,240 KB
testcase_17 AC 82 ms
15,060 KB
testcase_18 AC 81 ms
15,136 KB
testcase_19 AC 80 ms
15,252 KB
testcase_20 AC 82 ms
15,004 KB
testcase_21 AC 81 ms
15,104 KB
testcase_22 AC 81 ms
15,064 KB
testcase_23 AC 82 ms
15,220 KB
testcase_24 AC 82 ms
15,108 KB
testcase_25 AC 83 ms
15,144 KB
testcase_26 AC 80 ms
15,104 KB
testcase_27 WA -
testcase_28 AC 81 ms
15,088 KB
testcase_29 WA -
testcase_30 AC 81 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
           lose / 2
         else
           Rational(lose, 2).ceil
         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