結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー nasadigitalnasadigital
提出日時 2018-12-08 11:08:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 444 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 30,072 KB
最終ジャッジ日時 2023-10-12 04:56:09
合計ジャッジ時間 9,551 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
29,528 KB
testcase_01 AC 133 ms
29,636 KB
testcase_02 AC 134 ms
29,648 KB
testcase_03 AC 137 ms
29,568 KB
testcase_04 AC 135 ms
29,616 KB
testcase_05 AC 135 ms
29,628 KB
testcase_06 AC 134 ms
29,492 KB
testcase_07 AC 135 ms
29,680 KB
testcase_08 AC 136 ms
29,636 KB
testcase_09 AC 134 ms
29,768 KB
testcase_10 AC 135 ms
29,516 KB
testcase_11 AC 133 ms
29,476 KB
testcase_12 AC 133 ms
29,660 KB
testcase_13 AC 134 ms
29,692 KB
testcase_14 AC 133 ms
29,668 KB
testcase_15 AC 134 ms
29,552 KB
testcase_16 AC 133 ms
29,656 KB
testcase_17 AC 133 ms
29,704 KB
testcase_18 AC 136 ms
29,564 KB
testcase_19 AC 132 ms
29,668 KB
testcase_20 AC 132 ms
29,556 KB
testcase_21 AC 134 ms
29,568 KB
testcase_22 AC 135 ms
29,668 KB
testcase_23 AC 134 ms
29,576 KB
testcase_24 AC 135 ms
29,516 KB
testcase_25 AC 134 ms
29,516 KB
testcase_26 AC 135 ms
29,676 KB
testcase_27 AC 133 ms
29,624 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 161 ms
29,536 KB
testcase_31 AC 258 ms
29,876 KB
testcase_32 AC 134 ms
29,552 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 224 ms
29,864 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 AC 136 ms
29,528 KB
testcase_51 AC 134 ms
29,680 KB
testcase_52 AC 133 ms
29,644 KB
testcase_53 AC 132 ms
29,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
b = int(input()) 
n = int(input(), b)
digit = 0
l = 1
r = 60000
while l <= r:
    mid = (l + r) // 2
    tp = b ** mid
    cur_t = mid * tp - (tp - 1) // (b - 1)
    if cur_t >= n:
        r = mid - 1
        digit = mid
    else:
        l = mid + 1
n -= (digit - 1) * (b ** (digit - 1)) - (b ** (digit - 1) - 1) // (b - 1)
num = b ** (digit - 1) + ((n + digit - 1) // digit) - 1
print(np.base_repr(num, b)[(n - 1) % digit])
0