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

18612번 - Magic Strings 다국어

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

문제

Consider the sequence of strings F1, F2, . . . , defined as:

F1 = ab,

Fk+1 = FkFkb.

Calculate the number of distinct subsequences of the string Fn modulo 109 + 7.

입력

The first line of input contains a single integer t (1 ≤ t ≤ 10), which is the number of test cases.

The second line of input contains t integers n (1 ≤ n ≤ 1018), one for each test case.

출력

For each test case, output the single integer which is the answer to the problem. Separate consecutive answers by single spaces.

제한

예제 입력 1

3
1 2 3

예제 출력 1

4 17 226

힌트

The first three strings are: F1 = ab, F2 = ababb, and F3 = ababbababbb.

출처

Camp > Petrozavodsk Programming Camp > Summer 2019 > Day 4: Oleksandr Kulkov Contest 2 D번

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

출처

대학교 대회

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

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