結果

問題 No.1580 I like Logarithm!
ユーザー NatsubiSogan
提出日時 2021-07-02 22:39:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 568 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 18,336 KB
最終ジャッジ日時 2024-06-29 12:31:03
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other TLE * 1 -- * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

a = int(input())
b = list(map(int, list(input())))
ans = 0
mod = 10 ** 9 + 7
for i in range(1, len(b)):
    if i != len(b) - 1:
        ans += i * pow(a, i) * (a - 1)
        ans %= mod
    else:
        ans += i * (b[-(i + 1)] - 1) * pow(a, i)
        ans %= mod
########関数部分##############
def Base_n_to_10(X,n):
    out = 0
    for i in range(1,len(str(X))+1):
        out += int(X[-i])*(n**(i-1))
        out %= mod
    return out#int out
############################
print((ans + (len(b) - 1) * (Base_n_to_10("".join(list(map(str, b[1:]))), a) + 1)) % mod)
0