Problem F. Function Counting
时间限制 2000 ms
内存限制 149.83203125 MB
In this problem, we count the number of function f(x) satisfies below details.
1.f: M→M, ( M={-n,-n+1,-n+2,…,-1,0,1,…,n} )
2.$\forall x∈M, f_k (x)= -x,( f_0 (x)=x,f_i= f(f_{i-1} ) (i= 1,2,…) )$
3.$\forall x∈M, |(|f(x)|-|x|)|≤2$
输入数据
输出数据
For each test case output the answer % 1000000007.
样例输入
复制
7
1 1
2 1
100 1
1 2
2 2
3 2
20 4
样例输出
样例说明
If k = 1, only one function f(x) = -x exists. If n = k = 2, two functions exist. f: (-2, -1, 0, 1, 2) -> (1, -2, 0, 2, -1) or (-1, 2, 0, -2, 1).
$ Mathjax font initiator $