結果
問題 |
No.1651 Removing Cards
|
ユーザー |
|
提出日時 | 2021-08-21 00:01:06 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 414 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 85,888 KB |
最終ジャッジ日時 | 2024-10-14 08:27:36 |
合計ジャッジ時間 | 9,417 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 TLE * 1 -- * 22 |
ソースコード
def solve(n,k): res = 0 while n: res += 1 n -= (n-1)//K + 1 return res import sys input = sys.stdin.readline K,Q = map(int,input().split()) for _ in range(Q): n = int(input()) cnt = solve(n,K) ok = n ng = 0 while ok-ng>1: mid = (ok+ng)//2 if solve(mid,K)==cnt: ok = mid else: ng = mid print(ok)