結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー simansiman
提出日時 2020-12-08 16:19:43
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 11,224 KB
実行使用メモリ 31,708 KB
平均クエリ数 6.73
最終ジャッジ日時 2023-09-24 09:17:57
合計ジャッジ時間 5,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
31,064 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 122 ms
31,164 KB
testcase_05 AC 120 ms
31,272 KB
testcase_06 AC 117 ms
30,580 KB
testcase_07 AC 119 ms
30,784 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 119 ms
31,012 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 121 ms
31,192 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
R = (N - 1) % (K + 1)
turn = 0
b = 0

loop {
  if turn == 0
    if R == 0
      STDOUT.puts(0)
    else
      STDOUT.puts(R)
    end
  else
    r = (K + 1) - b % (K + 1)
    STDOUT.puts(b + r)
  end

  STDOUT.flush
  b = gets.to_i

  turn += 1
  break if b >= N
}
0