結果

問題 No.2541 Divide 01 String
ユーザー Meso Meso
提出日時 2025-06-03 10:29:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2025-06-03 10:29:58
合計ジャッジ時間 3,498 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

n = int(input())
s = input()

ans, t, = 0, 0

for i in range(n):
    if s[i] == "1":
        if ans == 0:
            ans = 1
        else:
            ans *= t + 2
            ans %= mod
        t = 0
    else:
        t += 1
print(ans) 
0