結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  PNJ | 
| 提出日時 | 2023-11-24 21:24:29 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 355 bytes | 
| コンパイル時間 | 198 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 59,904 KB | 
| 最終ジャッジ日時 | 2024-09-26 08:48:45 | 
| 合計ジャッジ時間 | 1,972 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 5 | 
ソースコード
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
print(ans)
            
            
            
        