結果
| 問題 |
No.1580 I like Logarithm!
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2021-07-02 22:52:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 252 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 71,040 KB |
| 最終ジャッジ日時 | 2024-06-29 12:43:18 |
| 合計ジャッジ時間 | 5,419 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 |
ソースコード
a=int(input())
b=list(map(int,input()))
mod=10**9+7
ans=0
n=len(b)
for i in range(1,n):
cnt=(pow(a,i,mod)-pow(a,i-1,mod))%mod
ans+=(i-1)*cnt
ans%=mod
x=0
for y in b:
x=(x*a+y)%mod
ans+=(n-1)*(x-pow(a,n-1,mod)+1)
ans%=mod
print(ans)
taiga0629kyopro