QOJ.ac

QOJ

時間限制: 25 s 記憶體限制: 1024 MB 總分: 100

#8424. 汉明距离

统计

给定一个长度为 $n$ 的二进制字符串 $s$。对于所有 $k$ 从 $1$ 到 $n$,计算长度恰好为 $k$ 的 $s$ 的所有子序列之间的两两汉明距离之和。由于答案可能非常大,请将其对 $40\,961$ 取模。

两个等长字符串之间的汉明距离是指这两个字符串在对应位置上不同的字符个数。

输入格式

输入仅一行,包含一个长度为 $n$ 的字符串 $s$ ($1 \le n \le 8 \cdot 10^3$),仅由字符 “0” 和 “1” 组成。

输出格式

输出 $n$ 个数字:第 $k$ 个数字应为长度恰好为 $k$ 的 $s$ 的所有子序列之间的两两汉明距离之和,对 $40\,961$ 取模。

样例

输入 1

11000110111001

输出 1

48 4056 15326 31033 20654 29362 32472 13700 21357 12217 20411 12456 212 0

输入 2

000

输出 2

0 0 0

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.