OPC3A - Arya and the exponacci
Arya is very fond of fibonacci numbers.He claimed he can solve any problem on fibonacci number.His clever friend golu gave him a challenge
to prove his skills.He gave him a sequence which he called exponacci.The sequence is given by
g(n)=2^f(n-1) for n>0
g(0)=1 for n==0
f(n) denotes the nth fibonacci number where
f(1)=1 (Obviously golu is not as good as arya in fibonacci numbers so he believes f(0)=1,anyways we have chosen not to disturb him)
f(n)=f(n-1)+f(n-2) for n>1
Help arya to find the nth exponacci number.Since the numbers can be very large take mod 10^9+7
The first line of the input will be the number of test cases(T<=2000). For each test case first line contains one integers n 0 <= n <= 1000000
The value of g(n)%(10^9+7)
Sample Cases : Input: 2 3 5 Output: 4 32
I know there must be a simple formula for this kind of probs~
Brute force to pre-compute fibonacci numbers works easily
source code limit is destroying the beauty of the question !! plz increase it...
Any better approach than Brute force!!!
Sandeep Singh Jakhar:
Time limit too high..
I cant submit solution to this problem.When i try to, judge says "Your solution is too long for this problem, the limit is 1000 bytes!"
What a nice problem
Simple Brute force worked for me ..
bashrc is back:
@leppyR64 it was modified after fitcat's comment.Thanx fitcat for pointing that out.
@fitcat: that's why the comment in the problem statement.