結果
問題 |
No.1651 Removing Cards
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:45:55 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 3,046 ms |
コンパイル使用メモリ | 82,208 KB |
実行使用メモリ | 92,428 KB |
最終ジャッジ日時 | 2025-06-12 21:53:15 |
合計ジャッジ時間 | 22,002 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 TLE * 1 -- * 19 |
ソースコード
def main(): import sys input = sys.stdin.read().split() ptr = 0 K = int(input[ptr]) ptr += 1 Q = int(input[ptr]) ptr += 1 for _ in range(Q): N = int(input[ptr]) ptr += 1 if N == 0: print(0) continue res = 1 current_N = N while current_N > 1: t = (current_N - 1) // K + 1 s = current_N - t res = res + (res - 1) // (K - 1) + 1 current_N = s print(res) if __name__ == '__main__': main()