結果

問題 No.2219 Re:010
ユーザー titiatitia
提出日時 2023-02-17 23:11:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 8,464 KB
最終ジャッジ日時 2023-09-26 20:33:08
合計ジャッジ時間 3,989 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,776 KB
testcase_01 AC 16 ms
7,764 KB
testcase_02 AC 16 ms
7,808 KB
testcase_03 AC 158 ms
8,044 KB
testcase_04 AC 33 ms
7,736 KB
testcase_05 AC 130 ms
8,204 KB
testcase_06 AC 45 ms
7,952 KB
testcase_07 AC 87 ms
8,072 KB
testcase_08 AC 152 ms
8,192 KB
testcase_09 AC 144 ms
8,064 KB
testcase_10 AC 117 ms
8,264 KB
testcase_11 AC 98 ms
8,032 KB
testcase_12 AC 102 ms
8,040 KB
testcase_13 AC 186 ms
8,348 KB
testcase_14 AC 184 ms
8,392 KB
testcase_15 AC 190 ms
8,440 KB
testcase_16 AC 185 ms
8,324 KB
testcase_17 AC 186 ms
8,340 KB
testcase_18 AC 125 ms
8,348 KB
testcase_19 AC 116 ms
8,392 KB
testcase_20 AC 238 ms
8,464 KB
testcase_21 AC 16 ms
7,732 KB
testcase_22 AC 16 ms
7,848 KB
testcase_23 AC 15 ms
7,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

S=input().strip()
mod=998244353

A=0
z=0
zo=0
q=1

for s in S:
    if s=="0":
        z+=1*q
        A+=zo
    elif s=="1":
        zo+=z
    else:
        A=A+A+zo
        zo=zo+zo+z
        z=z+z+1*q
        q*=2
        
    A%=mod
    z%=mod
    zo%=mod
    q%=mod
print(A)
0