多校6-Key Set 2015-08-09 20:35 2人阅读 评论(0) 收藏
Key Set
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 722 Accepted Submission(s): 442
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: 5368 5367 5366 5365 5364
快速幂
#include <map>
#include <list>
#include <climits>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define eps 1e-9
#define LL long long
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define CRR fclose(stdin)
#define CWW fclose(stdout)
#define RR freopen("input.txt","r",stdin)
#define WW freopen("output.txt","w",stdout)
const int Max = 10010;
const int Mod = 1000000007;
LL pow_mod(LL n)
{
LL res=1;
LL a=2;
while(n)
{
if(n&1)
{
res=(res*a)%Mod;
}
a=(a*a)%Mod;
n>>=1;
}
return res;
}
int main()
{
int T;
scanf("%d",&T);
LL n;
while(T--)
{
scanf("%I64d",&n);
printf("%I64d\n",pow_mod(n-1)-1);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
多校6-Key Set 2015-08-09 20:35 2人阅读 评论(0) 收藏的更多相关文章
- 多校4-Walk Out 分类: 比赛 2015-08-02 17:15 21人阅读 评论(0) 收藏
Walk Out Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Subm ...
- 周赛-Expression 分类: 比赛 2015-08-02 09:35 3人阅读 评论(0) 收藏
A. Expression time limit per test1 second memory limit per test256 megabytes inputstandard input out ...
- 多校3- RGCDQ 分类: 比赛 HDU 2015-07-31 10:50 2人阅读 评论(0) 收藏
RGCDQ Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practic ...
- 多校赛3- Painter 分类: 比赛 2015-07-29 19:58 3人阅读 评论(0) 收藏
D - Painter Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status P ...
- windows设置多长时间后自动关机 分类: windows常用小技巧 2014-04-15 09:35 230人阅读 评论(0) 收藏
分二步: 第一步:点击windows键,在"搜索程序和文件"的文本框输入:cmd 第二步:输入:shutdown -s -t (设置电脑一小时后自动关机) 备注: ...
- sscanf 函数 分类: POJ 2015-08-04 09:19 4人阅读 评论(0) 收藏
sscanf 其实很强大 分类: 纯C技术 技术笔记 2010-03-05 16:00 12133人阅读 评论(4) 收藏 举报 正则表达式stringbuffercurlgoogle 最近在做日志分 ...
- Win7设置承载网络 分类: 网络 2014-10-30 09:08 105人阅读 评论(0) 收藏
Win7设置承载网络 (1)最重要的第一步,要知道自己的网卡是否支持承载网络,如果不支持就悲剧地一票否决了,支持的话才能开始以后各步骤的设置. netsh wlan show drivers (2)设 ...
- 多校3-Magician 分类: 比赛 2015-07-31 08:13 4人阅读 评论(0) 收藏
Magician Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total ...
- c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏
C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...
随机推荐
- Lintcode: Route Between Two Nodes in Graph
Given a directed graph, design an algorithm to find out whether there is a route between two nodes. ...
- FlashBuilder 4.7 win64 和 mac版 下载地址
win64 http://trials3.adobe.com/AdobeProducts/FLBR/4_7/win64/FlashBuilder_4_7_LS10_win64.exe mac http ...
- java List 简单使用
Student类 class Student{ String name; String pwd; public Student(){} public Student(String name, Stri ...
- C++builder 图像字符流的存储和加载
__fastcall TForm6::TForm6(TComponent* Owner) : TForm(Owner) { #if 1 //for debug AllocConsole(); Atta ...
- 关于GridView只显示一样的问题
如果GridView不管怎么改都只能显示一行的话,就重写GridView,自定义GridView: public class MyGridView extends GridView { public ...
- 认真学习shell的第一天-数学运算
shell中的数学运算有三种方式: (1)let,用let的时候,变量名称前不用添加$ (2)[],[]中变量可使用也可不使用$ (3)(())变量名之前必须添加$
- HDU 1728 逃离迷宫(BFS)
Problem Description 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有 ...
- jquery on 动态添加的元素,神奇的bug
$(document.body).on("click", ".comments-item .link-comment", function () { 平时用 d ...
- ORA-12154的原因
一个很难想到的引起ORA-12154的原因 使用OracleClient.OracleConnection时(我连的是Oracle 9i,其他版本未知),如果你的执行目录太长或者有括号 ...
- angular form 验证
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...