結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  komkompi | 
| 提出日時 | 2023-11-24 22:16:30 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 52 ms / 2,000 ms | 
| コード長 | 379 bytes | 
| コンパイル時間 | 353 ms | 
| コンパイル使用メモリ | 82,588 KB | 
| 実行使用メモリ | 73,088 KB | 
| 最終ジャッジ日時 | 2024-09-26 09:27:56 | 
| 合計ジャッジ時間 | 2,235 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
# 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)
            
            
            
        