結果

問題 No.1620 Substring Sum
ユーザー qibqib
提出日時 2023-03-09 17:17:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 88,268 KB
最終ジャッジ日時 2023-10-18 06:18:52
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,308 KB
testcase_01 AC 38 ms
53,308 KB
testcase_02 AC 37 ms
53,308 KB
testcase_03 AC 37 ms
53,308 KB
testcase_04 AC 74 ms
88,244 KB
testcase_05 AC 73 ms
88,268 KB
testcase_06 AC 72 ms
88,268 KB
testcase_07 AC 72 ms
88,176 KB
testcase_08 AC 73 ms
88,224 KB
testcase_09 AC 72 ms
87,932 KB
testcase_10 AC 71 ms
88,152 KB
testcase_11 AC 70 ms
88,036 KB
testcase_12 AC 53 ms
69,424 KB
testcase_13 AC 69 ms
86,052 KB
testcase_14 AC 70 ms
86,228 KB
testcase_15 AC 67 ms
84,032 KB
testcase_16 AC 61 ms
77,676 KB
testcase_17 AC 67 ms
83,780 KB
testcase_18 AC 38 ms
53,336 KB
testcase_19 AC 38 ms
53,336 KB
testcase_20 AC 70 ms
88,268 KB
testcase_21 AC 71 ms
88,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

s = list(map(int, list(input())))

n = len(s)
pow2 = [1 for _ in range(n + 1)]
pow11 = [1 for _ in range(n + 1)]
for i in range(1, n + 1):
  pow2[i] = (pow2[i - 1] * 2) % MOD
  pow11[i] = (pow11[i - 1] * 11) % MOD

ans = 0
for i in range(n):
  ans = (ans + s[i] * pow2[i] * pow11[n - 1 - i]) % MOD

print(ans)
0