天天看点

1006.Funny Function

Problem Description Function Fx,ysatisfies: F1,1=F1,2=1 F1,i=F1,i−1+2∗F1,i−2(i>=3) Fi,j=∑j+N−1k=jFi−1,k(i>=2,j>=1) For given integers N and M,calculate Fm,1 modulo 1e9+7. Input There is one integer T in the first line. The next T lines,each line includes two integers N and M . 1<=T<=10000,1<=N,M<263. Output For each given N and M,print the answer in a single line. Sample Input 2 2 2 3 3 Sample Output 33

找规律的数学题,规律当时是找出来了,结果不会算。。

规律是:

⎧⎩⎨⎪⎪n为奇数,n为偶数,ans=2(2n−1)m−13ans=2(2n−1)m−1+13