QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100 Difficulté: [afficher]

#9489. 0100 插入

Statistiques

如果一个字符串 $T$ 可以通过对一个初始为空的字符串 $T$ 重复执行以下操作得到,则称其为“好字符串”:

  • 在 $T$ 的任意位置插入子串 0100

给定一个长度为 $N$ 的字符串 $S$,其中包含 01?。请计算通过将 $S$ 中的每个 ? 替换为 01,可以得到多少个好字符串。请输出答案对 $998244353$ 取模的结果。

输入格式

输入通过标准输入给出,格式如下:

$N$ $S$

  • $4 \le N \le 500$
  • $N$ 是 $4$ 的倍数。
  • $S$ 是一个长度为 $N$ 的字符串,由 01? 组成。

输出格式

在一行中输出答案。

样例

样例输入 1

8
0??0?100

样例输出 1

2

样例输入 2

4
?10?

样例输出 2

1

样例输入 3

28
???????????0???0??????1???0?

样例输出 3

2023

说明

在第一个样例中,通过将 $S$ 中的每个 ? 替换后,可以得到的好字符串为 0010010001000100

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.