HDU5363:Key Set

来源:互联网 发布:映速淘宝 编辑:程序博客网 时间:2024/06/17 19:23
A - A
Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I64u
Submit Status

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<cstdio>#define M 1000000007__int64 qpow(__int64 n){__int64 cnt=2,ans=1;while(n){if(n&1){ans=ans*cnt%M;}cnt=cnt*cnt%M;n>>=1;}return ans;}int main(){__int64 t;scanf("%I64d",&t);while(t--){__int64 n;scanf("%I64d",&n);//找规律 printf("%I64d\n",qpow(n-1)-1);}return 0;} 

0 0