結果
| 問題 |
No.1651 Removing Cards
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2019-03-23 07:13:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 210 bytes |
| コンパイル時間 | 636 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 64,640 KB |
| 最終ジャッジ日時 | 2024-10-14 02:11:00 |
| 合計ジャッジ時間 | 3,344 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 RE * 1 |
| other | WA * 32 |
ソースコード
n, k=map(int, input().split())
def solve(x):
if x<=k:
return x
y=solve(x-(x+k-1)//k)
q=y//(k-1)
r=y%(k-1)
if r==0:
return q*k
else:
return q*k+1+r
print(solve(n))
chocorusk