結果
| 問題 |
No.1651 Removing Cards
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:41:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 532 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 82,052 KB |
| 実行使用メモリ | 91,880 KB |
| 最終ジャッジ日時 | 2025-06-12 21:45:44 |
| 合計ジャッジ時間 | 8,569 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 TLE * 1 -- * 19 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
K = int(input[idx])
idx += 1
Q = int(input[idx])
idx += 1
for _ in range(Q):
N = int(input[idx])
idx += 1
res = 1
current_n = N
while current_n > 1:
t = (current_n - 1) // K + 1
next_n = current_n - t
p = res
m = (p + K - 2) // (K - 1)
res = p + m
current_n = next_n
print(res)
if __name__ == '__main__':
main()
gew1fw