結果

問題 No.1651 Removing Cards
ユーザー taiga0629kyopro
提出日時 2021-08-20 23:40:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 473 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 67,468 KB
最終ジャッジ日時 2024-10-14 07:43:47
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline  # 文字列入力はするな!!
from _collections import defaultdict
import sys
sys.setrecursionlimit(10**9)
def f(k,n):
    def g(x):
        return x-(x-1)//k-1

    if n<=k:return n
    ind=f(k,n-((n-1)//k)-1)

    mi=0
    ma=5*10**18
    while ma-mi>1:
        mid=(ma+mi)//2
        if g(mid)>=ind:
            ma=mid
        else:
            mi=mid
    return ma

for _ in range(q):
    n=int(input())
    print(f(k,n))

0