結果

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

ソースコード

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