結果

問題 No.2541 Divide 01 String
コンテスト
ユーザー hiro1729
提出日時 2023-11-24 21:35:53
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 42 ms / 2,000 ms
+ 514µs
コード長 222 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 96 ms
コンパイル使用メモリ 63,800 KB
実行使用メモリ 58,340 KB
最終ジャッジ日時 2026-11-21 04:25:40
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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