結果

問題 No.1651 Removing Cards
ユーザー chineristACchineristAC
提出日時 2021-08-21 00:01:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 414 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,052 KB
実行使用メモリ 87,844 KB
最終ジャッジ日時 2024-04-22 09:14:12
合計ジャッジ時間 9,522 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
58,960 KB
testcase_01 AC 35 ms
51,840 KB
testcase_02 AC 76 ms
59,520 KB
testcase_03 AC 41 ms
58,112 KB
testcase_04 AC 42 ms
57,984 KB
testcase_05 AC 43 ms
57,472 KB
testcase_06 AC 47 ms
58,496 KB
testcase_07 AC 42 ms
57,600 KB
testcase_08 AC 41 ms
58,240 KB
testcase_09 AC 728 ms
81,408 KB
testcase_10 AC 1,892 ms
81,408 KB
testcase_11 AC 1,200 ms
81,024 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n,k):
    res = 0
    while n:
        res += 1
        n -= (n-1)//K + 1
    return res

import sys

input = sys.stdin.readline

K,Q = map(int,input().split())
for _ in range(Q):
    n = int(input())

    cnt = solve(n,K)
    
    ok = n
    ng = 0
    while ok-ng>1:
        mid = (ok+ng)//2
        if solve(mid,K)==cnt:
            ok = mid
        else:
            ng = mid
    
    print(ok)

    
0