結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー maimai
提出日時 2017-07-22 04:44:27
言語 Ruby
(3.3.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 11,492 KB
実行使用メモリ 31,444 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-24 01:25:13
合計ジャッジ時間 6,289 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
31,412 KB
testcase_01 AC 123 ms
31,092 KB
testcase_02 AC 131 ms
31,348 KB
testcase_03 AC 128 ms
30,700 KB
testcase_04 AC 125 ms
31,328 KB
testcase_05 AC 128 ms
31,176 KB
testcase_06 AC 125 ms
30,872 KB
testcase_07 AC 124 ms
31,080 KB
testcase_08 AC 128 ms
31,068 KB
testcase_09 AC 127 ms
31,236 KB
testcase_10 AC 126 ms
31,444 KB
testcase_11 AC 125 ms
30,596 KB
testcase_12 AC 124 ms
30,912 KB
testcase_13 AC 126 ms
31,092 KB
testcase_14 AC 128 ms
30,844 KB
testcase_15 AC 124 ms
31,304 KB
testcase_16 AC 123 ms
30,872 KB
testcase_17 AC 126 ms
31,104 KB
testcase_18 AC 125 ms
30,720 KB
testcase_19 AC 126 ms
31,016 KB
testcase_20 AC 126 ms
31,264 KB
testcase_21 AC 127 ms
30,584 KB
testcase_22 AC 125 ms
31,140 KB
testcase_23 AC 125 ms
31,288 KB
testcase_24 AC 124 ms
31,056 KB
testcase_25 AC 124 ms
30,992 KB
testcase_26 AC 130 ms
30,760 KB
testcase_27 AC 128 ms
31,020 KB
testcase_28 AC 126 ms
31,212 KB
testcase_29 AC 127 ms
31,036 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #


n,kei = gets.split.map(&:to_i)
g = kei+1

@ini = n
def grant
    q = gets.to_i
    exit 0 if @ini <= q
    q
end

if @ini%g == 1
    p 0
else
    pay = (n-1)%g
    p pay
end
    
loop{
    $>.flush
    r = grant()
    p r + (@ini-r-1)%g
    n-=g
}
0