結果
| 問題 | No.1580 I like Logarithm! | 
| コンテスト | |
| ユーザー |  ntuda | 
| 提出日時 | 2025-03-22 13:58:58 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 288 bytes | 
| コンパイル時間 | 321 ms | 
| コンパイル使用メモリ | 82,100 KB | 
| 実行使用メモリ | 67,892 KB | 
| 最終ジャッジ日時 | 2025-03-22 13:59:02 | 
| 合計ジャッジ時間 | 4,583 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 19 RE * 20 | 
ソースコード
A = int(input())
B = input()
DB = int(B,A)
m = len(B)
AA = 1
mod = 10 ** 9 + 7
ans = 0
pre = A
i = 0
for i in range(1,m-1):
    now = pre * A
    now %= mod
    ans += (now - pre) * i
    ans %= mod
    pre = now
if DB >= pre:
    ans += (DB - pre + 1) * (i + 1)
    ans %= mod
print(ans)
            
            
            
        