結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  PNJ | 
| 提出日時 | 2023-11-24 21:25:26 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 51 ms / 2,000 ms | 
| コード長 | 376 bytes | 
| コンパイル時間 | 339 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 60,160 KB | 
| 最終ジャッジ日時 | 2024-09-26 08:49:27 | 
| 合計ジャッジ時間 | 2,184 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
import sys
input = lambda: sys.stdin.readline().strip()
def Map():
  return list(map(int,input().split()))
N = int(input())
S = input()
mod = 998244353
ans = 1
f = 0
c = 0
for i in range(N):
  if f:
    if S[i] == '1':
      ans *= (c+1)
      ans %= mod
      c = 1
    else:
      c += 1
  else:
    if S[i] == '1':
      f = 1
      c = 1
if f == 0:
  ans = 0
print(ans)
            
            
            
        