結果
| 問題 |
No.1620 Substring Sum
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:56:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 467 bytes |
| コンパイル時間 | 252 ms |
| コンパイル使用メモリ | 82,716 KB |
| 実行使用メモリ | 72,260 KB |
| 最終ジャッジ日時 | 2025-03-20 18:57:40 |
| 合計ジャッジ時間 | 2,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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