結果

問題 No.1651 Removing Cards
ユーザー carrot46carrot46
提出日時 2021-08-20 22:20:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 952 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 10,492 KB
実行使用メモリ 22,700 KB
最終ジャッジ日時 2023-08-04 07:03:55
合計ジャッジ時間 23,958 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,944 KB
testcase_01 AC 16 ms
7,852 KB
testcase_02 AC 86 ms
12,656 KB
testcase_03 AC 17 ms
7,900 KB
testcase_04 AC 17 ms
7,980 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 16 ms
7,992 KB
testcase_07 AC 16 ms
7,936 KB
testcase_08 AC 17 ms
7,892 KB
testcase_09 AC 594 ms
8,040 KB
testcase_10 AC 603 ms
7,912 KB
testcase_11 AC 599 ms
7,912 KB
testcase_12 AC 600 ms
7,936 KB
testcase_13 AC 606 ms
7,932 KB
testcase_14 AC 607 ms
8,048 KB
testcase_15 AC 936 ms
22,504 KB
testcase_16 AC 894 ms
22,056 KB
testcase_17 AC 923 ms
22,548 KB
testcase_18 AC 914 ms
21,844 KB
testcase_19 AC 952 ms
21,816 KB
testcase_20 AC 914 ms
21,472 KB
testcase_21 AC 917 ms
21,856 KB
testcase_22 AC 851 ms
22,648 KB
testcase_23 AC 583 ms
7,988 KB
testcase_24 AC 580 ms
7,908 KB
testcase_25 AC 848 ms
22,592 KB
testcase_26 AC 850 ms
21,736 KB
testcase_27 AC 912 ms
22,520 KB
testcase_28 AC 900 ms
22,572 KB
testcase_29 AC 921 ms
22,700 KB
testcase_30 AC 917 ms
22,572 KB
testcase_31 AC 934 ms
22,632 KB
testcase_32 AC 585 ms
8,000 KB
testcase_33 AC 612 ms
8,032 KB
testcase_34 AC 597 ms
7,928 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