結果

問題 No.1580 I like Logarithm!
ユーザー yudai1102jp
提出日時 2021-07-02 22:36:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 288 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,076 KB
最終ジャッジ日時 2024-06-29 12:27:59
合計ジャッジ時間 9,456 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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))+1
    else:
        now *= A
    ans = (ans+i*now % MOD) % MOD

print(ans)
0