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

20596번 - Hardcore String Counting 2 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB394480.000%

문제

What happened to "Hardcore String Counting 1"? That's a secret!

A non-empty word $v$ over some alphabet is a square if it can be represented as $v = ww$ for some word $w$.

A word is square-free if all its non-empty substrings are not squares.

Your task is to compute the number of square-free words of length $\ell$ over the alphabet {a, b, c} for each $\ell$ from 1ドル$ to $n$.

입력

The only line of the input contains an integer $n$ (1ドル \leq n \leq 120$).

출력

For each $\ell$ from 1ドル$ to $n,ドル print the number of square-free words of length $\ell$ over the alphabet {a, b, c} on a separate line.

제한

예제 입력 1

10

예제 출력 1

3
6
12
18
30
42
60
78
108
144

힌트

You can see https://oeis.org/A006156 for more details, but this probably won't help you much.

출처

Camp > Petrozavodsk Programming Camp > Summer 2020 > Day 2: SPb SU LOUD ENOUGH Contest H번

Contest > Open Cup > 2020/2021 Season > Stage 2: SPb SU LOUD ENOUGH Contest H번

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

출처

대학교 대회

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

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