結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  ntuda | 
| 提出日時 | 2023-11-25 00:28:12 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 62 ms / 2,000 ms | 
| コード長 | 328 bytes | 
| コンパイル時間 | 403 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 76,180 KB | 
| 最終ジャッジ日時 | 2024-09-26 09:50:52 | 
| 合計ジャッジ時間 | 2,593 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
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)
            
            
            
        