結果

問題 No.1651 Removing Cards
ユーザー chocorusk
提出日時 2021-06-19 20:47:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 192 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-14 02:13:39
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 RE * 1
other WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
n, k=map(int, input().split())
def solve(x):
    if x<=k:
        return x-1
    y=solve(x-(x+k-1)//k)
    return y//(k-1)*k+1+y%(k-1)
print(solve(n)+1)
0