2015 multiply 6 1011
2015-08-06 20:03
176 查看
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 integer n (1≤n≤109),
the number of integers in the set.
Output
For each test case, output the number of key sets modulo 1000000007.
Sample Input
4 1 2 3 4
Sample Output
0 1 3 7
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 1000000007 int 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; }
相关文章推荐
- Dungeon Master ZOJ 1940【优先队列+广搜】
- 网络安全专有(一个)
- linux 的dmesg命令
- php5中虚函数的实现
- Java 算法编程 N阶乘末尾0的个数问题
- Android Design Support Library使用示例(一)
- grep
- MyBatis insert和select例子
- 读写文件
- 1039. Course List for Student (25)
- TwoSum leetcode
- iOS开发-Day19-OC NSDictionary&NSMutableDictionary&NSSet&NSMutableSet
- (一)SQLite数据库
- 用zcat查看压缩日志中百度抓取的量
- dfs样板
- 最短路
- Android代码内存优化建议-Java官方篇
- 数据挖掘十大经典算法
- [HDU 1561] The more, The Better 树形dp
- goxceed