結果

問題 No.1620 Substring Sum
ユーザー rlangevinrlangevin
提出日時 2023-07-04 08:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 85,528 KB
最終ジャッジ日時 2024-07-18 05:29:41
合計ジャッジ時間 2,090 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,404 KB
testcase_01 AC 35 ms
52,672 KB
testcase_02 AC 36 ms
54,048 KB
testcase_03 AC 35 ms
52,276 KB
testcase_04 AC 59 ms
85,528 KB
testcase_05 AC 61 ms
84,348 KB
testcase_06 AC 60 ms
84,888 KB
testcase_07 AC 62 ms
84,180 KB
testcase_08 AC 60 ms
84,232 KB
testcase_09 AC 66 ms
84,136 KB
testcase_10 AC 62 ms
85,368 KB
testcase_11 AC 63 ms
84,200 KB
testcase_12 AC 47 ms
67,340 KB
testcase_13 AC 60 ms
81,600 KB
testcase_14 AC 60 ms
82,084 KB
testcase_15 AC 57 ms
79,820 KB
testcase_16 AC 54 ms
74,608 KB
testcase_17 AC 57 ms
79,160 KB
testcase_18 AC 36 ms
53,216 KB
testcase_19 AC 38 ms
52,324 KB
testcase_20 AC 62 ms
84,556 KB
testcase_21 AC 61 ms
84,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
S = list(map(int, S))
S.reverse()
mod = 998244353
N = len(S)
two = pow(2, N - 1, mod)
inv = pow(2, mod - 2, mod)
eleven = 1
ans = 0
for s in S:
    ans += two * s * eleven
    ans %= mod
    two *= inv
    eleven *= 11
    two %= mod
    eleven %= mod

print(ans)
0