結果
問題 |
No.1651 Removing Cards
|
ユーザー |
![]() |
提出日時 | 2025-06-12 17:08:15 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 367 ms |
コンパイル使用メモリ | 82,040 KB |
実行使用メモリ | 92,584 KB |
最終ジャッジ日時 | 2025-06-12 17:08:24 |
合計ジャッジ時間 | 8,183 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 TLE * 1 -- * 19 |
ソースコード
import sys def main(): 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 current_M = N current_f = 1 while current_M > 1: R = (current_M - 1) // K + 1 next_M = current_M - R x = (current_f - 1) // (K - 1) P = current_f + x + 1 current_f = P current_M = next_M print(current_f) if __name__ == '__main__': main()