結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
34,008 KB
testcase_01 AC 138 ms
29,460 KB
testcase_02 AC 139 ms
29,564 KB
testcase_03 AC 136 ms
29,544 KB
testcase_04 AC 140 ms
29,556 KB
testcase_05 AC 141 ms
29,572 KB
testcase_06 AC 142 ms
29,484 KB
testcase_07 AC 135 ms
29,608 KB
testcase_08 AC 137 ms
29,532 KB
testcase_09 AC 139 ms
29,552 KB
testcase_10 AC 133 ms
29,456 KB
testcase_11 AC 138 ms
29,640 KB
testcase_12 AC 133 ms
29,668 KB
testcase_13 AC 139 ms
29,516 KB
testcase_14 AC 140 ms
29,500 KB
testcase_15 AC 143 ms
29,652 KB
testcase_16 AC 137 ms
29,460 KB
testcase_17 AC 143 ms
29,648 KB
testcase_18 AC 144 ms
29,640 KB
testcase_19 AC 133 ms
29,592 KB
testcase_20 AC 132 ms
29,528 KB
testcase_21 AC 136 ms
29,620 KB
testcase_22 AC 138 ms
29,476 KB
testcase_23 AC 135 ms
29,668 KB
testcase_24 AC 140 ms
29,492 KB
testcase_25 AC 139 ms
29,600 KB
testcase_26 AC 144 ms
29,516 KB
testcase_27 AC 142 ms
29,636 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 168 ms
29,604 KB
testcase_31 AC 269 ms
29,752 KB
testcase_32 AC 143 ms
29,548 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 232 ms
29,748 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 TLE -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
b = int(input()) 
n = int(input(), b)
digit = 0
l = 1
r = 100000
while l <= r:
    mid = (l + r) // 2
    cur_t = mid * (b ** mid) - ((b ** mid) - 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