結果

問題 No.1620 Substring Sum
ユーザー ayaoniayaoni
提出日時 2021-07-22 21:53:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 743 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 104,692 KB
最終ジャッジ日時 2023-09-24 16:37:41
合計ジャッジ時間 3,574 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,400 KB
testcase_01 AC 71 ms
71,388 KB
testcase_02 AC 72 ms
71,240 KB
testcase_03 AC 72 ms
71,196 KB
testcase_04 AC 107 ms
104,568 KB
testcase_05 AC 105 ms
104,484 KB
testcase_06 AC 104 ms
104,656 KB
testcase_07 AC 106 ms
104,408 KB
testcase_08 AC 105 ms
104,692 KB
testcase_09 AC 104 ms
104,260 KB
testcase_10 AC 103 ms
104,352 KB
testcase_11 AC 104 ms
104,168 KB
testcase_12 AC 85 ms
83,572 KB
testcase_13 AC 103 ms
101,188 KB
testcase_14 AC 104 ms
101,268 KB
testcase_15 AC 100 ms
98,284 KB
testcase_16 AC 91 ms
90,736 KB
testcase_17 AC 100 ms
98,144 KB
testcase_18 AC 71 ms
71,204 KB
testcase_19 AC 70 ms
71,512 KB
testcase_20 AC 104 ms
104,444 KB
testcase_21 AC 103 ms
104,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


S = S()
N = len(S)
mod = 998244353

power0 = [1]
for _ in range(N):
    power0.append((power0[-1]*11) % mod)
power1 = [1]
for _ in range(N):
    power1.append((power1[-1]*2) % mod)

ans = 0
for i in range(N):
    s = int(S[i])
    ans += s*power0[N-1-i]*power1[i]
    ans %= mod

print(ans)
0