結果
| 問題 | 
                            No.257 N言っちゃダメゲーム (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 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 | 
ソースコード
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