結果

問題 No.757 チャンパーノウン定数 (2)
ユーザー nasadigitalnasadigital
提出日時 2018-12-08 11:31:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 443 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 30,004 KB
最終ジャッジ日時 2023-10-12 04:57:57
合計ジャッジ時間 9,697 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
29,608 KB
testcase_01 AC 137 ms
29,548 KB
testcase_02 AC 129 ms
29,644 KB
testcase_03 AC 129 ms
29,604 KB
testcase_04 AC 132 ms
29,620 KB
testcase_05 AC 129 ms
29,476 KB
testcase_06 AC 130 ms
29,592 KB
testcase_07 AC 139 ms
29,592 KB
testcase_08 AC 143 ms
29,532 KB
testcase_09 AC 143 ms
29,660 KB
testcase_10 AC 138 ms
29,664 KB
testcase_11 AC 139 ms
29,684 KB
testcase_12 AC 141 ms
29,636 KB
testcase_13 AC 138 ms
29,472 KB
testcase_14 AC 132 ms
29,540 KB
testcase_15 AC 132 ms
29,500 KB
testcase_16 AC 130 ms
29,536 KB
testcase_17 AC 133 ms
29,688 KB
testcase_18 AC 133 ms
29,500 KB
testcase_19 AC 135 ms
29,492 KB
testcase_20 AC 139 ms
29,620 KB
testcase_21 AC 139 ms
29,668 KB
testcase_22 AC 139 ms
29,532 KB
testcase_23 AC 141 ms
29,600 KB
testcase_24 AC 143 ms
29,608 KB
testcase_25 AC 140 ms
29,596 KB
testcase_26 AC 141 ms
29,468 KB
testcase_27 AC 140 ms
29,532 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 141 ms
29,744 KB
testcase_31 AC 140 ms
29,684 KB
testcase_32 AC 140 ms
29,624 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 142 ms
29,616 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 146 ms
29,860 KB
testcase_43 AC 193 ms
29,812 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 AC 149 ms
29,716 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 AC 138 ms
29,620 KB
testcase_51 AC 137 ms
29,604 KB
testcase_52 AC 135 ms
29,612 KB
testcase_53 AC 136 ms
29,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
b = int(input()) 
def count(mid):
    tp = b ** mid
    return mid * tp - (tp - 1) // (b - 1)
n = int(input(), b)
digit = 0
l = 1
r = 100000
while l <= r:
    mid = (l + r) // 2
    cur_t = count(mid)
    if cur_t >= n:
        r = mid - 1
        digit = mid
    else:
        l = mid + 1
n -= count(digit - 1)
num = b ** (digit - 1) + ((n + digit - 1) // digit) - 1
print((num//(b ** (digit - 1 - ((n - 1) % digit)))) % b)
0