key set

来源:互联网 发布:软件著作权个人申请 编辑:程序博客网 时间:2024/05/22 06:14

Description

soda has a set  with  integers . A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of  are key set.
 

Input

There are multiple test cases. The first line of input contains an integer  , indicating the number of test cases. For each test case: 

The first line contains an integer  , the number of integers in the set.
 

Output

For each test case, output the number of key sets modulo 1000000007.
 

Sample Input

41234
 

Sample Output

0137
 

#include<stdio.h>

__int64 quickpow(__int64 a,__int64 b,__int64 c)
{
__int64 tmp=a,res=1;
while(b)
{
if(b&1)
{
res*=tmp;
        res%=c;
        }
        tmp*=tmp;
        tmp%=c;
        b>>=1;
}
return res;   
}
int main()
{
__int64 n;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%I64d",&n);
printf("%d\n",quickpow(2,n-1,1000000007)-1);
}
return 0;
}
0 0