結果
| 問題 |
No.1620 Substring Sum
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:17:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 467 bytes |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 82,448 KB |
| 実行使用メモリ | 72,176 KB |
| 最終ジャッジ日時 | 2025-03-20 21:18:42 |
| 合計ジャッジ時間 | 2,218 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
mod = 998244353
s = input().strip()
n = len(s)
# Precompute powers of 2 modulo mod
pow2 = [1] * n
for i in range(1, n):
pow2[i] = (pow2[i-1] * 2) % mod
# Precompute powers of 11 modulo mod
pow11 = [1] * n
for i in range(1, n):
pow11[i] = (pow11[i-1] * 11) % mod
total = 0
for i in range(n):
d = int(s[i])
exponent_11 = n - 1 - i
term = d * pow2[i] % mod
term = term * pow11[exponent_11] % mod
total = (total + term) % mod
print(total)
lam6er