結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー 👑 rin204
提出日時 2022-01-20 07:13:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,148 KB
実行使用メモリ 70,460 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-07-17 03:07:24
合計ジャッジ時間 4,916 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
N = n
tot = 0
if (n - 1) % (k + 1) == 0:
    print(0, flush = True)
    a = int(input())
    if a >= N: exit()
    n -= a
    tot += a

while 1:
    x = (n - 1) % (k + 1)
    print(tot + x, flush = True)
    n -= x
    tot += x
    a = int(input())
    if a >= N: exit()
    n -= a - tot
    tot = a
0