結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー tjake
提出日時 2015-12-20 04:46:41
言語 Python2
(2.7.18)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 25,232 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-07-16 22:13:30
合計ジャッジ時間 4,304 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdout
n, k = map(int, raw_input().split())
def output(s):
    stdout.write(`s`+"\n")
    stdout.flush()
if (n-1)%(k+1)<1 or n==1:
    output(0)
else:
    output((n-1)%(k+1))
while 1:
    p = input()
    if p>=n: exit(0)
    q = n-p
    p += (q-1)%(k+1)
    if p>=n: exit(1)
    output(p)
0