2015 multiply 6 1011
来源:互联网 发布:catiav5r22软件下载 编辑:程序博客网 时间:2024/06/04 19:41
Key Set
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 207 Accepted Submission(s): 135
Problem Description
soda has a set S with n integers {1,2,…,n} . 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 S are key set.
Input
There are multiple test cases. The first line of input contains an integer T (1≤T≤105) , indicating the number of test cases. For each test case:
The first line contains an integern (1≤n≤109) , the number of integers in the set.
The first line contains an integer
Output
For each test case, output the number of key sets modulo 1000000007.
Sample Input
41234
Sample Output
0137
Source
2015 Multi-University Training Contest 6
Recommend
wange2014 | We have carefully selected several similar problems for you: 5363 5362 5361 5360 5359
//#pragma comment(linker, "/STACK:1024000000,1024000000")#include<cstdio>#include<cmath>#include<stdlib.h>#include<map>#include<set>#include<time.h>#include<vector>#include<queue>#include<string>#include<string.h>#include<iostream>#include<algorithm>using namespace std;#define eps 1e-8#define INF 0x3f3f3f3f#define LL long long#define max(a,b) ((a)>(b)?(a):(b))#define min(a,b) ((a)<(b)?(a):(b))typedef pair<int , int> P;#define mod 1000000007int main(){ int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); int ans = 1; int a = 2; n--; while(n) { if(n & 1) ans = ((LL)ans * a) % mod; a = ((LL)a * a) % mod; n >>= 1; } ans--; printf("%d\n", ans % mod); } return 0;}
1 0
- 2015 multiply 6 1011
- Multiply
- Multiply
- Quaternion Multiply:
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- Multiply Strings
- HDU 5019 Revenge of GCD(简单枚举)
- php5中虚函数的实现
- grep, egrep
- Android Design Support Library使用示例(一)
- Android 登录注册功能
- 2015 multiply 6 1011
- 基于邻接矩阵的广度优先搜索遍历 (BFS)
- 最少步数 bfs样板
- Apache commons-pool对象池原理分析
- Git fetch和git pull的区别
- Java之猜字母小游戏
- 文件系统总结2
- HDU 4183--Pahom on Water【最大流dinic】
- Ganymed SSH-2 java执行远程linux机器命令工具