POWFIB - Fibo and non fibo
The problem is simple.
Find (a^b) % MOD
a = Nth non-fibonacci number
b = (Nth fibonacci number)%MOD
MOD = 10^9+7
Consider fibonacci series as 1,1,2,3,....
Note : It is guaranteed that Nth non-fibonacci number will always be less than MOD value for every value of N used.
First line contains T , the number of test cases.
Each next T lines contains a number N.
Print T lines of output where each line corresponds to the required answer.
Announcement: Constraints are updated. Sorry for inconvenience occurred.
3 3 2 1
49 6 4
For N=3 : 3rd non fibo number =7, 3rd fibo number=2. ans= (7^2) %MOD =49
For N=2 : 2nd non fibo number =6, 2nd fibo number=1. ans=(6^1) %MOD=6
For N=1 : 1st non fibo number =4, 1st fibo number=1. ans= (4^1) %MOD =4
Note: Test cases have been updated and costraints are changed. Those who get TLE or WA are suggested to resubmit. GOOD LUCK there.
easy one Ac in first attempt
@ivar.raknahs Why did you changed the constraints after 100 successful submission Please revert it back to the original. This is not a good practice. While re-judging did you check this option Refresh cached info about test sequence.
nice..Last edit: 2015-07-21 06:59:48
@Pulkit if you find this too easy you may give atry to this one.
Easy One :)
@ivar.raknahs & @[Lakshman] :: btw what should i do to make it fasterLast edit: 2015-07-19 22:23:25
After 10 WA's & TLE's.....finally green :-)
2 days. finally AC ! :D :D
giving w.a after 9 judge...