結果
問題 |
No.1651 Removing Cards
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:06:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 465 ms |
コンパイル使用メモリ | 81,932 KB |
実行使用メモリ | 92,312 KB |
最終ジャッジ日時 | 2025-06-12 17:06:42 |
合計ジャッジ時間 | 8,197 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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()