結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー suppy193suppy193
提出日時 2015-08-05 16:09:38
言語 Ruby
(3.3.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 31,532 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 21:19:39
合計ジャッジ時間 5,291 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
30,708 KB
testcase_01 AC 107 ms
31,328 KB
testcase_02 AC 105 ms
30,852 KB
testcase_03 AC 104 ms
31,116 KB
testcase_04 AC 106 ms
31,532 KB
testcase_05 AC 105 ms
30,688 KB
testcase_06 AC 104 ms
31,136 KB
testcase_07 AC 105 ms
31,284 KB
testcase_08 AC 109 ms
30,784 KB
testcase_09 AC 112 ms
31,268 KB
testcase_10 AC 112 ms
30,932 KB
testcase_11 AC 106 ms
31,096 KB
testcase_12 AC 105 ms
31,064 KB
testcase_13 AC 110 ms
31,220 KB
testcase_14 AC 107 ms
31,064 KB
testcase_15 AC 106 ms
31,276 KB
testcase_16 AC 106 ms
31,436 KB
testcase_17 AC 108 ms
31,492 KB
testcase_18 AC 103 ms
31,512 KB
testcase_19 AC 102 ms
31,244 KB
testcase_20 AC 109 ms
30,860 KB
testcase_21 AC 106 ms
31,300 KB
testcase_22 AC 104 ms
30,760 KB
testcase_23 AC 107 ms
30,936 KB
testcase_24 AC 107 ms
30,688 KB
testcase_25 AC 107 ms
31,508 KB
testcase_26 AC 110 ms
31,324 KB
testcase_27 AC 112 ms
31,188 KB
testcase_28 AC 106 ms
31,064 KB
testcase_29 AC 103 ms
31,392 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, k = gets.strip.split(' ').map(&:to_i)
r = (n - 1) % (k + 1)
if n % (k + 1) == 1
    puts "0"
else
    puts r
end
STDOUT.flush
i = 1
while true
    opp = gets.strip.to_i
    if opp >= n
        break
    end
    puts i * (k + 1) + r
    STDOUT.flush
    i += 1
end
0