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

13075번 - Fibonacci Sequence 다국어

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

문제

Your job is to take an integer x as the input and compute f(x) mod 109, where f(x) is the x-th value in the well-known Fibonacci sequence.

Note that Fibonacci sequence is defined as follows:

f(1) = f(2) = 1
f(k) = f(k-1) + f(k-2) for any k > 2

입력

The first line of the input includes the number of test cases, 1 ≤ t ≤ 1000. Each test case is a line containing an integer 1 ≤ x ≤ 248.

출력

For each test case, print one line containing f(x) mod 109

제한

예제 입력 1

11
1
2
8
20
46
60
3749999998
3749999999
3750000000
3750000001
281474976710656

예제 출력 1

1
1
21
6765
836311903
8755920
499999999
500000001
0
500000001
309764667

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > Iran Internet Programming Contest > IIPC 2015 C번

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

출처

대학교 대회

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

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