結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
29,672 KB
testcase_01 AC 132 ms
29,648 KB
testcase_02 AC 132 ms
29,716 KB
testcase_03 AC 133 ms
29,684 KB
testcase_04 AC 134 ms
29,628 KB
testcase_05 AC 133 ms
29,492 KB
testcase_06 AC 132 ms
29,640 KB
testcase_07 AC 134 ms
29,692 KB
testcase_08 AC 134 ms
29,728 KB
testcase_09 AC 136 ms
29,512 KB
testcase_10 AC 134 ms
29,532 KB
testcase_11 AC 134 ms
29,520 KB
testcase_12 AC 133 ms
29,512 KB
testcase_13 AC 134 ms
29,664 KB
testcase_14 AC 135 ms
29,596 KB
testcase_15 AC 137 ms
29,484 KB
testcase_16 AC 135 ms
29,596 KB
testcase_17 AC 134 ms
29,620 KB
testcase_18 AC 135 ms
29,536 KB
testcase_19 AC 134 ms
29,512 KB
testcase_20 AC 134 ms
29,664 KB
testcase_21 AC 134 ms
29,636 KB
testcase_22 AC 135 ms
29,712 KB
testcase_23 AC 134 ms
29,616 KB
testcase_24 AC 134 ms
29,464 KB
testcase_25 AC 135 ms
29,756 KB
testcase_26 AC 136 ms
29,464 KB
testcase_27 AC 137 ms
29,664 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 160 ms
29,756 KB
testcase_31 AC 265 ms
29,736 KB
testcase_32 AC 136 ms
29,560 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 225 ms
29,812 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 135 ms
29,660 KB
testcase_51 AC 135 ms
29,668 KB
testcase_52 AC 137 ms
29,588 KB
testcase_53 AC 135 ms
29,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
b = int(input()) 
n = int(input(), b)
digit = 0
l = 1
r = 50000
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