結果
| 問題 |
No.1580 I like Logarithm!
|
| コンテスト | |
| ユーザー |
yuusanlondon
|
| 提出日時 | 2021-07-02 21:38:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 277 bytes |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 62,976 KB |
| 最終ジャッジ日時 | 2024-06-29 11:10:35 |
| 合計ジャッジ時間 | 3,621 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 |
ソースコード
MOD=10**9+7
a=int(input())
b=input()
n=len(b)
ans=0
tmp=0
curr=1
for i in range(n):
k=int(b[n-1-i])
if i<n-1:
ans=(ans+i*curr*(a-1))%MOD
else:
ans=(ans+i*curr*(k-1))%MOD
if i<n-1:
tmp+=(curr*k)%MOD
curr=(curr*a)%MOD
ans=(ans+(tmp+1)*(n-1))%MOD
print(ans)
yuusanlondon