結果

問題 No.1620 Substring Sum
ユーザー brthyyjpbrthyyjp
提出日時 2021-09-13 10:24:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 570 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 105,428 KB
最終ジャッジ日時 2023-09-07 15:21:59
合計ジャッジ時間 5,178 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
104,404 KB
testcase_01 AC 113 ms
100,164 KB
testcase_02 AC 116 ms
100,064 KB
testcase_03 AC 111 ms
100,080 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 10**6
mod = 998244353
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

table = [0]*N
table[0] = 1
for i in range(1, N):
    table[i] = table[i-1]*11
    table[i] %= mod

s = str(input())
n = len(s)
ans = 0
for i, c in enumerate(s):
    ans += int(c)*table[n-1-i]*(1<<i)
    ans %= mod
print(ans)
0