結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
29,660 KB
testcase_01 AC 139 ms
29,624 KB
testcase_02 AC 137 ms
29,568 KB
testcase_03 AC 134 ms
29,656 KB
testcase_04 AC 135 ms
29,588 KB
testcase_05 AC 136 ms
29,532 KB
testcase_06 AC 139 ms
29,640 KB
testcase_07 AC 137 ms
29,564 KB
testcase_08 AC 140 ms
29,620 KB
testcase_09 AC 138 ms
29,540 KB
testcase_10 AC 136 ms
29,476 KB
testcase_11 AC 135 ms
29,520 KB
testcase_12 AC 139 ms
29,704 KB
testcase_13 AC 141 ms
29,688 KB
testcase_14 AC 140 ms
29,696 KB
testcase_15 AC 140 ms
29,656 KB
testcase_16 AC 137 ms
29,676 KB
testcase_17 AC 140 ms
29,656 KB
testcase_18 AC 141 ms
29,688 KB
testcase_19 AC 138 ms
29,676 KB
testcase_20 AC 135 ms
29,468 KB
testcase_21 AC 137 ms
29,684 KB
testcase_22 AC 138 ms
29,640 KB
testcase_23 AC 138 ms
29,612 KB
testcase_24 AC 139 ms
29,648 KB
testcase_25 AC 136 ms
29,604 KB
testcase_26 AC 141 ms
29,668 KB
testcase_27 AC 141 ms
29,720 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 163 ms
29,532 KB
testcase_31 AC 266 ms
29,764 KB
testcase_32 AC 142 ms
29,764 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 229 ms
29,636 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 140 ms
29,504 KB
testcase_51 AC 140 ms
29,576 KB
testcase_52 AC 137 ms
29,428 KB
testcase_53 AC 135 ms
29,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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