結果
| 問題 | No.2541 Divide 01 String |
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2023-12-01 14:34:31 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 324 bytes |
| 記録 | |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 79,104 KB |
| 最終ジャッジ日時 | 2026-04-13 18:01:22 |
| 合計ジャッジ時間 | 2,147 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
N=int(input())
S=input()
if S=='0'*N:
print(0)
exit()
from collections import deque
d=deque()
for s in S:
d.append(s)
while d[0]=='0':
d.popleft()
while d[-1]=='0':
d.pop()
d.popleft()
ans=1;now=0
while d:
c=d.popleft()
if c=='0':
now+=1
else:
ans*=now+2
now=0
ans%=998244353
print(ans)
timi