結果

問題 No.1580 I like Logarithm!
ユーザー yudai1102jp
提出日時 2021-07-02 22:41:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 293 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 17,820 KB
最終ジャッジ日時 2024-06-29 12:33:29
合計ジャッジ時間 8,668 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 13 RE * 12 TLE * 2 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
A = int(input())

B = input()
logB = len(B)-1
B = int(B, A)

MOD = 10**9+7

# logB = int(math.log(B, A))
ans = 0
now = (A-1)
for i in range(1, logB+1):
    if i == logB:
        now = B-(pow(A, logB, MOD))+1
    else:
        now *= A
    ans = (ans+i*now % MOD) % MOD

print(ans)
0