結果

問題 No.756 チャンパーノウン定数 (1)
ユーザー nasadigitalnasadigital
提出日時 2018-12-08 11:32:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 29,756 KB
最終ジャッジ日時 2023-10-12 04:58:02
合計ジャッジ時間 4,223 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
29,692 KB
testcase_01 AC 130 ms
29,684 KB
testcase_02 AC 129 ms
29,696 KB
testcase_03 AC 135 ms
29,556 KB
testcase_04 AC 129 ms
29,604 KB
testcase_05 AC 130 ms
29,736 KB
testcase_06 AC 129 ms
29,700 KB
testcase_07 AC 131 ms
29,640 KB
testcase_08 AC 132 ms
29,552 KB
testcase_09 AC 131 ms
29,748 KB
testcase_10 AC 130 ms
29,688 KB
testcase_11 AC 130 ms
29,640 KB
testcase_12 AC 131 ms
29,756 KB
testcase_13 AC 129 ms
29,596 KB
testcase_14 AC 129 ms
29,564 KB
testcase_15 AC 131 ms
29,592 KB
testcase_16 AC 131 ms
29,696 KB
testcase_17 AC 130 ms
29,604 KB
testcase_18 AC 130 ms
29,576 KB
testcase_19 AC 130 ms
29,708 KB
testcase_20 AC 131 ms
29,680 KB
testcase_21 AC 130 ms
29,664 KB
testcase_22 AC 130 ms
29,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
b = 10
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