結果
問題 | No.1651 Removing Cards |
ユーザー |
![]() |
提出日時 | 2025-06-12 17:06:53 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 532 bytes |
コンパイル時間 | 511 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 92,560 KB |
最終ジャッジ日時 | 2025-06-12 17:07:02 |
合計ジャッジ時間 | 8,250 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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()