結果

問題 No.2541 Divide 01 String
ユーザー hiro1729hiro1729
提出日時 2023-11-24 21:35:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 72,920 KB
最終ジャッジ日時 2023-11-24 21:35:55
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 33 ms
53,460 KB
testcase_03 AC 41 ms
61,712 KB
testcase_04 AC 44 ms
67,856 KB
testcase_05 AC 47 ms
72,308 KB
testcase_06 AC 43 ms
65,808 KB
testcase_07 AC 45 ms
72,480 KB
testcase_08 AC 49 ms
72,724 KB
testcase_09 AC 49 ms
72,920 KB
testcase_10 AC 44 ms
72,400 KB
testcase_11 AC 44 ms
72,396 KB
testcase_12 AC 43 ms
72,396 KB
testcase_13 AC 36 ms
53,460 KB
testcase_14 AC 35 ms
53,460 KB
testcase_15 AC 34 ms
53,460 KB
testcase_16 AC 34 ms
53,460 KB
testcase_17 AC 34 ms
53,460 KB
testcase_18 AC 35 ms
53,460 KB
testcase_19 AC 34 ms
53,460 KB
testcase_20 AC 34 ms
53,460 KB
testcase_21 AC 34 ms
53,460 KB
testcase_22 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

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