結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-11-24 21:31:51 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 64 ms / 2,000 ms | 
| コード長 | 232 bytes | 
| コンパイル時間 | 563 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 80,512 KB | 
| 最終ジャッジ日時 | 2024-09-26 08:54:59 | 
| 合計ジャッジ時間 | 2,286 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
MOD = 998244353
N = int(input())
S = input()
pos_1 = []
for i, c in enumerate(S):
  if c == '1':
    pos_1.append(i)
ans = int(bool(pos_1))
for j in range(len(pos_1)-1):
  ans *= pos_1[j+1] - pos_1[j] + 1
  ans %= MOD
print(ans)
            
            
            
        