結果

問題 No.2541 Divide 01 String
ユーザー hiro1729
提出日時 2023-11-24 21:35:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 72,960 KB
最終ジャッジ日時 2024-09-26 08:58:12
合計ジャッジ時間 2,370 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip('0')
n = len(s)
if n == 0:
	exit(print(0))
ans = 1
now = 0
mod = 998244353
for i in s:
	if i == '0':
		now += 1
	else:
		ans = ans * (now + 2) % mod
		now = 0
print(ans * 499122177 % mod)
0