結果

問題 No.1580 I like Logarithm!
ユーザー SPD_9X2
提出日時 2021-07-02 22:10:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 67,456 KB
最終ジャッジ日時 2024-06-29 11:45:59
合計ジャッジ時間 3,753 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

A = 10だと
1からBまでの桁数

i桁目

"""

A = int(input())

B = input()
mod = 10**9+7

tenb = 0
for i in B:
    tenb *= A
    tenb += ord(i) - ord('0')
    tenb %= mod

ans = tenb * len(B)

#print (ans)

sml = 0
for i in range(len(B)):
    sub = pow(A,i,mod) - 1
    #print (i,sub)
    ans -= sub

print ((ans-tenb) % mod)

"""
tenb = 0
ans = 0
for i in B:
    tenb *= A
    tenb %= mod
    ans += tenb
    ans %= mod
    tenb += ord(i) - ord('0')
"""
0