結果
問題 | No.1620 Substring Sum |
ユーザー |
![]() |
提出日時 | 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 = 998244353s = input().strip()n = len(s)# Precompute powers of 2 modulo modpow2 = [1] * nfor i in range(1, n):pow2[i] = (pow2[i-1] * 2) % mod# Precompute powers of 11 modulo modpow11 = [1] * nfor i in range(1, n):pow11[i] = (pow11[i-1] * 11) % modtotal = 0for i in range(n):d = int(s[i])exponent_11 = n - 1 - iterm = d * pow2[i] % modterm = term * pow11[exponent_11] % modtotal = (total + term) % modprint(total)