Logo
(追記) (追記ここまで)

18950번 - Hamming 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
25 초 1024 MB132125.000%

문제

You are given a binary string $s$ of length $n$. Compute the sum of pairwise Hamming distances between all subsequences of string $s$ with length exactly $k$ for all $k$ from 1ドル$ to $n$. Since the answers can be very large, find them modulo 40ドル,961円$.

Hamming distance between two strings of equal length is the number of positions in which these two strings are different.

입력

The only line of input contains a string $s$ of length $n$ (1ドル \le n \le 8 \cdot 10^{3}$) containing only characters "0" and "1".

출력

Print $n$ numbers: $k$-th of them must be the sum of pairwise Hamming distances between all subsequences of string $s$ with length exactly $k,ドル taken modulo 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

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 1: t.me / umnik_team Contest E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /