結果

問題 No.1651 Removing Cards
ユーザー carrot46carrot46
提出日時 2021-08-20 22:20:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,001 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,216 KB
最終ジャッジ日時 2024-04-22 05:03:00
合計ジャッジ時間 25,686 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 100 ms
15,360 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,880 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 653 ms
10,752 KB
testcase_10 AC 638 ms
10,752 KB
testcase_11 AC 630 ms
10,752 KB
testcase_12 AC 655 ms
10,752 KB
testcase_13 AC 640 ms
10,752 KB
testcase_14 AC 650 ms
10,752 KB
testcase_15 AC 995 ms
24,960 KB
testcase_16 AC 986 ms
24,448 KB
testcase_17 AC 983 ms
25,088 KB
testcase_18 AC 963 ms
24,192 KB
testcase_19 AC 987 ms
24,320 KB
testcase_20 AC 973 ms
24,064 KB
testcase_21 AC 938 ms
24,320 KB
testcase_22 AC 863 ms
25,216 KB
testcase_23 AC 650 ms
10,752 KB
testcase_24 AC 620 ms
10,880 KB
testcase_25 AC 888 ms
25,216 KB
testcase_26 AC 872 ms
24,448 KB
testcase_27 AC 921 ms
25,216 KB
testcase_28 AC 947 ms
25,088 KB
testcase_29 AC 1,001 ms
25,216 KB
testcase_30 AC 959 ms
25,216 KB
testcase_31 AC 972 ms
25,216 KB
testcase_32 AC 633 ms
10,752 KB
testcase_33 AC 651 ms
10,752 KB
testcase_34 AC 646 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

K, Q = map(int, input().split())
lst = []
x = 0
while x < (1<<60):
  lst.append(x)
  x += 1
  x *= K
  x -= 1
  x //= K - 1

for t in range(Q):
  N = int(input())
  index = bisect.bisect(lst, N - 1)
  if index >= 1:
    index -= 1
  print(lst[index] + 1)
0