結果
| 問題 | No.1580 I like Logarithm! |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-01-18 03:00:31 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 30 ms / 2,000 ms |
| + 958µs | |
| コード長 | 390 bytes |
| 記録 | |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 81,372 KB |
| 実行使用メモリ | 70,232 KB |
| 最終ジャッジ日時 | 2026-09-28 15:09:34 |
| 合計ジャッジ時間 | 4,388 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 |
ソースコード
MOD = 10 ** 9 + 7
a = int(input())
B = input()
l = len(B)
if l == 1:
print(0)
exit()
ans = 0
times = a - 1
for i in range(l - 1):
ans += i * times
ans %= MOD
times *= a
times %= MOD
tot = 0
times = 1
for b in B[::-1]:
tot += times * int(b)
tot %= MOD
times *= a
times %= MOD
ans += (tot - pow(a, l - 1, MOD) + 1) * (l - 1) % MOD
print(ans % MOD)