結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー 👑 KazunKazun
提出日時 2020-11-13 16:46:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 87,616 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-24 02:48:56
合計ジャッジ時間 5,811 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
87,376 KB
testcase_01 AC 113 ms
87,104 KB
testcase_02 AC 114 ms
87,312 KB
testcase_03 AC 115 ms
87,328 KB
testcase_04 AC 115 ms
87,424 KB
testcase_05 AC 116 ms
86,680 KB
testcase_06 AC 113 ms
87,444 KB
testcase_07 AC 115 ms
87,132 KB
testcase_08 AC 115 ms
87,340 KB
testcase_09 AC 114 ms
86,848 KB
testcase_10 AC 115 ms
87,364 KB
testcase_11 AC 116 ms
87,064 KB
testcase_12 AC 115 ms
87,040 KB
testcase_13 AC 114 ms
87,516 KB
testcase_14 AC 115 ms
87,036 KB
testcase_15 AC 115 ms
87,152 KB
testcase_16 AC 114 ms
87,548 KB
testcase_17 AC 114 ms
86,836 KB
testcase_18 AC 116 ms
87,188 KB
testcase_19 AC 114 ms
87,616 KB
testcase_20 AC 112 ms
87,260 KB
testcase_21 AC 114 ms
87,244 KB
testcase_22 AC 114 ms
87,532 KB
testcase_23 AC 113 ms
87,320 KB
testcase_24 AC 115 ms
87,476 KB
testcase_25 AC 117 ms
87,260 KB
testcase_26 AC 114 ms
87,344 KB
testcase_27 AC 117 ms
87,120 KB
testcase_28 AC 115 ms
87,092 KB
testcase_29 AC 113 ms
86,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def say(k):
    print(k,flush=True)

def listen(n):
    k=int(input())
    if k>=n:
        exit()
    return k

#================================================
N,K=map(int,input().split())
if (N-1)%(K+1)==0:
    say(0)
    p=listen(N)
else:
    p=0

T=N-1-p
while True:
    if T%(K+1)==0:
        T-=K+1
    else:
        T=(T//(K+1))*(K+1)

    say(N-1-T)
    p=listen(N)
    T=N-1-p
0