Responsive image

问题 1891 --Array Challenge

1891: Array Challenge

时间限制: 2 Sec  内存限制: 128 MB
提交: 1  解决: 1
[提交][状态][讨论版][命题人:]

题目描述

here’s an array that is generated by following rule.
h0=2,h1=3,h2=6,hn=4hn−1+17hn−2−12hn−3−16
And let us define two arrays bnandan as below.
bn=3hn+1hn+9hn+1hn−1+9hn^2+27hnhn−1−18hn+1−126hn−81hn−1+192(n>0)
an=bn+4n
Now, you have to print ⌊√(an)⌋ , n>1.
Your answer could be very large so print the answer modular 1000000007.
 

输入描述

The first line of input contains T (1 <= T <= 1000) , the number of test cases.
Each test case contains one integer n (1 < n <= 10^15) in one line.
 

输出描述

For each test case print &#8970;√(a_n )&#8971; modular 1000000007.
 

样例输入

3
4
7
9

样例输出

1255
324725
13185773

来源

 

[提交][状态]
ACM算法攻关部