結果

問題 No.2541 Divide 01 String
ユーザー ntudantuda
提出日時 2023-11-25 00:28:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,980 KB
最終ジャッジ日時 2023-11-25 00:28:15
合計ジャッジ時間 1,990 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 41 ms
62,200 KB
testcase_04 AC 46 ms
67,384 KB
testcase_05 AC 50 ms
75,196 KB
testcase_06 AC 44 ms
67,116 KB
testcase_07 AC 51 ms
75,172 KB
testcase_08 AC 51 ms
75,980 KB
testcase_09 AC 52 ms
75,980 KB
testcase_10 AC 46 ms
75,332 KB
testcase_11 AC 46 ms
75,468 KB
testcase_12 AC 48 ms
75,468 KB
testcase_13 AC 34 ms
53,460 KB
testcase_14 AC 33 ms
53,460 KB
testcase_15 AC 34 ms
53,460 KB
testcase_16 AC 35 ms
53,460 KB
testcase_17 AC 35 ms
53,460 KB
testcase_18 AC 42 ms
65,556 KB
testcase_19 AC 41 ms
65,548 KB
testcase_20 AC 42 ms
65,532 KB
testcase_21 AC 41 ms
62,996 KB
testcase_22 AC 41 ms
62,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
N = int(input())
S = list(input())
ans = 0
f = 0

for s in S:
    if f == 0:
        if s == "1":
            f = 1
            cnt = 1
            ans = 1
    elif f == 1:
        if s == "0":
            cnt += 1
        else:
            ans *= (cnt + 1)
            ans %= MOD
            cnt = 1
print(ans)
0