結果
| 問題 |
No.1651 Removing Cards
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-18 19:54:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 956 ms / 2,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 449 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 25,088 KB |
| 最終ジャッジ日時 | 2024-10-10 13:18:26 |
| 合計ジャッジ時間 | 24,546 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
from bisect import bisect_right
K, Q = map(int, input().split())
def ceildiv(x, y):
return (x + y - 1) // y
lst = [1]
MAX = 10**18
while lst[-1] <= MAX:
# y = x - (x + K - 1) // K
# x = y * K / (K - 1)
x = ceildiv(lst[-1] * K, K - 1)
lst.append(x)
for _ in range(Q):
n = int(input())
print(lst[bisect_right(lst, n) - 1])