多校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#中的委托和事件 一文,我想你对委托和事件已经有了一个基本的认识.但那些远不是委托和事件的全部内容,还有很多的地方没有涉及.本文将讨论委托和事件一些更为 ...
随机推荐
- 《30天自制操作系统》08_day_学习笔记
harib05a: 鼠标解读(01)P145 前一天已经让鼠标成功接收数据了,这些数据是什么意思? 笔者在这一部分来解读数据:让鼠标动起来啊,停在那不动有什么意思啊! 前面已经知道,鼠标每一次动作都是 ...
- Swift语言实战晋级-第9章 游戏实战-跑酷熊猫-3 显示一个动态的熊猫
一个静态的熊猫明显不能满足我们的欲望,接下来我们就让熊猫跑起来.序列帧动画的原理就是不停的切换不同的图片.当我们将一张一张的切换Panda类的跑动文理后,熊猫就跑起来了.那么首先我们需要一个数组常量来 ...
- 输入和输出的总结(c语言)
c语言中有多种的输入和输出方式,下面就简单总结一下: 一.输入的三种方式 (1)scanf scanf 函数可以在变量中使用,也可以在数组中使用,当然指针上也能用到,是一个很好的输入函数.scanf是 ...
- Python学习总结12:sys模块
sys模块常用来处理Python运行时配置以及资源,从而可以与前当程序之外的系统环境交互. 1. 导入及函数查看 >>> import sys #导入sys模块 >>&g ...
- Android Handler简单使用
package com.example.myhandlertest3; import android.os.Bundle; import android.os.Handler; import andr ...
- 移动widget开发
发现Oracle----php连接有很多bug无法解决,只好转向php--连接mysql数据库,并装载了mysql两个文件,跟客户端NAVICAT_FOR_MYSQL,然后直接建表,用于测试,能够连通 ...
- 夺命雷公狗---Thinkphp----5之数据库的链接
我们打开WEB目录下发现了Common和Home以及Runtime这三个文件夹 那么我们第一个目标是完成网站后台的首页吧,那么我们就直接将Home的文件夹复制一份出来,并且改名为Admin这样就可以分 ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON HWindowX 01
zw版[转发·台湾nvp系列Delphi例程]HALCON HWindowX 01 procedure TForm1.Button1Click(Sender: TObject);var img : H ...
- 解决ultravnc在win2008 R2下CTRL+ALT+DELETEA组合键发送失败的问题
首先,请google “ultravnc ctrl+alt+delete”,得到的解决方法是,更改UAC.进入组策略-计算机配置-管理模板-windows登陆选项,“禁用或启用软件注意序列”,更改成“ ...
- dota BP练习工具开发:一个C/S多用户程序
首发:个人博客,更新&纠错&回复 客户端采用C#开发,服务器使用java开发,通信方式为socket. 1.首先决定交互协议 客户端指令协议: getgames:要求服务端发送game ...