結果

問題 No.2541 Divide 01 String
ユーザー komkompikomkompi
提出日時 2023-11-24 22:16:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 72,856 KB
最終ジャッジ日時 2023-11-24 22:16:33
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 40 ms
61,716 KB
testcase_04 AC 41 ms
65,804 KB
testcase_05 AC 47 ms
72,312 KB
testcase_06 AC 44 ms
65,812 KB
testcase_07 AC 69 ms
72,312 KB
testcase_08 AC 49 ms
72,856 KB
testcase_09 AC 50 ms
72,856 KB
testcase_10 AC 47 ms
72,344 KB
testcase_11 AC 45 ms
72,340 KB
testcase_12 AC 47 ms
72,488 KB
testcase_13 AC 34 ms
53,460 KB
testcase_14 AC 33 ms
53,460 KB
testcase_15 AC 33 ms
53,460 KB
testcase_16 AC 34 ms
53,460 KB
testcase_17 AC 34 ms
53,460 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 34 ms
53,460 KB
testcase_20 AC 35 ms
53,460 KB
testcase_21 AC 35 ms
53,460 KB
testcase_22 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())
S=input()

MOD=998244353

if "1" not in S:
    print(0)
    exit()

ans=1
count=-1
for s in S:
    if s=="1":
        if count==-1:
            count=0
        else:
            ans*=(count+2)
            ans%=MOD
            count=0
    else:
        if count==-1:
            pass
        else:
            count+=1

print(ans)
0