Function Counting

TimeLimit:2000MS  MemoryLimit:153428KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
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$
Input
The first line of input contains an integer T (1 <= T <= 100) , the number of test cases.
Each test case contains a pair of integers n, k (n * k <= $10^9$), the upper limit of the set M and degree of f.
The total sum of n * k over all test cases does not exceed 4e9.
Output
For each test case output the answer % 1000000007.
SampleInput
7
1 1
2 1
100 1
1 2
2 2 
3 2
20 4
SampleOutput
1
1
1
0
2
0
1048576
 Hint 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).
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: