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) 收藏的更多相关文章

  1. 多校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 ...

  2. 周赛-Expression 分类: 比赛 2015-08-02 09:35 3人阅读 评论(0) 收藏

    A. Expression time limit per test1 second memory limit per test256 megabytes inputstandard input out ...

  3. 多校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 ...

  4. 多校赛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 ...

  5. windows设置多长时间后自动关机 分类: windows常用小技巧 2014-04-15 09:35 230人阅读 评论(0) 收藏

    分二步: 第一步:点击windows键,在"搜索程序和文件"的文本框输入:cmd 第二步:输入:shutdown -s -t          (设置电脑一小时后自动关机) 备注: ...

  6. sscanf 函数 分类: POJ 2015-08-04 09:19 4人阅读 评论(0) 收藏

    sscanf 其实很强大 分类: 纯C技术 技术笔记 2010-03-05 16:00 12133人阅读 评论(4) 收藏 举报 正则表达式stringbuffercurlgoogle 最近在做日志分 ...

  7. Win7设置承载网络 分类: 网络 2014-10-30 09:08 105人阅读 评论(0) 收藏

    Win7设置承载网络 (1)最重要的第一步,要知道自己的网卡是否支持承载网络,如果不支持就悲剧地一票否决了,支持的话才能开始以后各步骤的设置. netsh wlan show drivers (2)设 ...

  8. 多校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 ...

  9. c#委托和事件(下) 分类: C# 2015-03-09 08:42 211人阅读 评论(0) 收藏

    C#中的委托和事件(下) 引言 如果你看过了 C#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...

随机推荐

  1. Java基础之泛型——使用二叉树进行排序(TryBinaryTree)

    控制台程序. 1.实现针对容器类的基于集合的循环 为了让容器类类型的对象能够在基于集合的for循环中可用,类必须并且只需要满足一个要求——必须实现泛型接口java.lang.Iterable<& ...

  2. php基础语法学习汇总

    常量学习: <?php # function demo function sum($x,$y){ $z=$x+$y; return $z; } echo sum(1,2); #define de ...

  3. leetcode95 Unique Binary Search Trees II

    题目: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. F ...

  4. PostgreSQL Replication之第十章 配置Slony(1)

    在PostgreSQL领域中,Slony是最广泛的复制解决方案之一.它不仅是最老的复制方案实现的一个,但也是有最多的外部工具支持的一个,例如PgAdmin3等. 在本章中,我们将深入探究Slony并学 ...

  5. session 和 cookie 的区别与联系

    1.创建一个新的Cookie Cookie cookie = new Cookie("username",name); 2.设置cookie在客户端上存活多久 cookie.set ...

  6. paper 10:支持向量机系列七:Kernel II —— 核方法的一些理论补充,关于 Reproducing Kernel Hilbert Space 和 Representer Theorem 的简介。

    在之前我们介绍了如何用 Kernel 方法来将线性 SVM 进行推广以使其能够处理非线性的情况,那里用到的方法就是通过一个非线性映射 ϕ(⋅) 将原始数据进行映射,使得原来的非线性问题在映射之后的空间 ...

  7. 夺命雷公狗—angularjs—21—解决angularjs压缩问题

    我们在实际的开发中往往离不开js的代码压缩,因为这样可以减轻服务器的压力,是的的方法如下所示: <!DOCTYPE html> <html lang="en" n ...

  8. 「Ruby && Sqlite3」How to install sqlite3 for ruby? (solve: sqlite-ruby no such file...)

    error message:           no such file .... 安装 gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/lo ...

  9. 安装SQLServer2005错误无法在com+目录中安装和配置程序集

    无法在com+目录中安装和配置程序集c:\program files\Microsoft SQL Server\90\DTS\tasks\microsoft.sqlserver.MSMQTASK.DL ...

  10. AndroidUI自动化测试工具-UIautomator

    转自:http://www.cnblogs.com/rexmzk/archive/2012/12/26/2834380.html 最近公司在开展Android的自动化测试,美国那边的开发人员利用And ...