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

16029번 - Fibonacci representations 서브태스크다국어

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

문제

Let us define the sequence of Fibonacci numbers as:

  • F1 = 1
  • F2 = 2
  • Fn = Fn−1 + Fn−2 for n ≥ 3

The first few elements of the sequence are 1, 2, 3, 5, 8, 13, 21, . . .

For a positive integer p, let X(p) denote the number of different ways of expressing p as a sum of different Fibonacci numbers. Two ways are considered different if there is a Fibonacci number that exists in exactly one of them.

You are given a sequence of n positive integers a1, a2, . . . , an. For a non-empty prefix a1, a2, . . . , ak, we define pk = Fa1 + Fa2 + . . . + Fak. Your task is to find the values X(pk) modulo 109 + 7, for all k = 1, . . . , n.

입력

The first line of the standard input contains an integer n (1 ≤ n ≤ 100 000). The second line contains n space-separated integers a1, a2, . . . , an (1 ≤ ai ≤ 109).

출력

The standard output should contain n lines. In the k-th line, print the value X(pk) modulo (109 + 7).

제한

서브태스크

번호배점제한
15

n, ai ≤ 15

220

n, ai ≤ 100

315

n ≤ 100, ai are squares of different natural numbers

410

n ≤ 100

515

ai are different even numbers

635

No additional constraints

예제 입력 1

4
4 1 1 5

예제 출력 1

2
2
1
2

We have the following values pk:

  • p1 = F4 = 5
  • p2 = F4 + F1 = 5 + 1 = 6
  • p3 = F4 + F1 + F1 = 5 + 1 + 1 = 7
  • p4 = F4 + F1 + F1 + F5 = 5 +たす 1 +たす 1 +たす 8 = 15

The number 5 can be expressed in two ways: as F2+F3 and simply as F4 (that is, 2+ 3 and 5, respectively). Hence, X(p1) = 2.

Then we have X(p2) = 2 because p2 = 1 +たす 5 = 1 +たす 2 +たす 3.

The only way to express 7 as a sum of different Fibonacci numbers is 2 + 5.

Finally, 15 can be expressed as 2 + 13 and 2 + 5 + 8 (two ways).

힌트

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2018 > Day 2 4번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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