結果

問題 No.1620 Substring Sum
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-22 22:23:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 335 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 93,580 KB
最終ジャッジ日時 2023-09-24 17:33:11
合計ジャッジ時間 5,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,260 KB
testcase_01 AC 74 ms
71,224 KB
testcase_02 AC 73 ms
71,060 KB
testcase_03 AC 74 ms
71,404 KB
testcase_04 AC 180 ms
93,440 KB
testcase_05 AC 185 ms
93,488 KB
testcase_06 AC 180 ms
93,580 KB
testcase_07 AC 180 ms
93,452 KB
testcase_08 AC 180 ms
93,312 KB
testcase_09 AC 176 ms
93,220 KB
testcase_10 AC 179 ms
93,432 KB
testcase_11 AC 176 ms
93,368 KB
testcase_12 AC 110 ms
81,016 KB
testcase_13 AC 171 ms
91,412 KB
testcase_14 AC 171 ms
91,828 KB
testcase_15 AC 160 ms
90,008 KB
testcase_16 AC 135 ms
86,496 KB
testcase_17 AC 155 ms
89,624 KB
testcase_18 AC 74 ms
71,176 KB
testcase_19 AC 72 ms
71,320 KB
testcase_20 AC 180 ms
93,452 KB
testcase_21 AC 180 ms
93,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

寄与を考える

二乗なら簡単だが…





"""

import sys
from sys import stdin

lsum = 1

S = list(map(int,list(stdin.readline()[:-1])))

S.reverse()
N = len(S)


ans = 0
mod = 998244353

for i in range(N):

    ans += lsum * S[i] * pow(2,N-1-i,mod)
    ans %= mod

    lsum += lsum * 10
    lsum %= mod

print (ans)
0