杭电-5363 Key Set

 

Key Set

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 1781    Accepted Submission(s): 937


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 (1T105) , indicating the number of test cases. For each test case:

The first line contains an integer n (1n109) , 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
 

Author
zimpha@zju
 

Source
 

Recommend
wange2014

#include<stdio.h>
int quictpow(__int64 m)
{
	int ans=1;
	__int64 base=2;
	while(m>0)
	{
		if(m%2==1)
		{
			ans=(ans*base)%1000000007;
		}
		base=(base*base)%1000000007;
		m=m/2;
	}
	return ans;
}
int main()
{
	int t;
	__int64 n;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%I64d",&n);
		printf("%d\n",quictpow(n-1)-1);
	}
	return 0;
}


 

杭电电子设计<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg"> <!-- 背景 --> <rect width="800" height="600" fill="#f8f8f8"/> <!-- 标题 --> <text x="400" y="30" font-family="Arial" font-size="20" text-anchor="middle" fill="#333">温度测试装置电路设计原理图</text> <!-- STM32F103C8T6微控制器 --> <rect x="300" y="150" width="200" height="100" fill="#e6f2ff" stroke="#3366cc" stroke-width="2"/> <text x="400" y="200" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">STM32F103C8T6</text> <!-- DS18B20温度传感器 --> <rect x="150" y="250" width="100" height="50" fill="#ffe6e6" stroke="#cc3333" stroke-width="2"/> <text x="200" y="280" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">DS18B20</text> <!-- LCD1602显示屏 --> <rect x="550" y="250" width="150" height="80" fill="#e6ffe6" stroke="#33cc33" stroke-width="2"/> <text x="625" y="290" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">LCD1602</text> <!-- 按键模块 --> <rect x="150" y="350" width="100" height="80" fill="#fff6cc" stroke="#cc9933" stroke-width="2"/> <text x="200" y="380" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">按键模块</text> <!-- LED指示灯 --> <rect x="550" y="350" width="100" height="50" fill="#ffe6ff" stroke="#cc33cc" stroke-width="2"/> <text x="600" y="380" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">LED指示灯</text> <!-- 电源部分 --> <rect x="350" y="450" width="100" height="80" fill="#f2f2f2" stroke="#666666" stroke-width="2"/> <text x="400" y="480" font-family="Arial" font-size="14" text-anchor="middle" fill="#333">电源部分</text> <!-- 连接线 --> <!-- DS18B20连接到STM32 --> <line x1="250" y1="275" x2="300" y2="200" stroke="#333" stroke-width="1.5"/> <text x="275" y="230" font-family="Arial" font-size="12" text-anchor="middle" fill="#333">PA1 (DQ)</text> <!-- LCD1602连接到STM32 --> <line x1="550" y1="290" x2="500" y2="200" stroke="#333" stroke-width="1.5"/> <text x="525" y="240" font-family="Arial" font-size="12" text-anchor="middle" fill="#333">PB0-PB7</text> <!-- 按键模块连接到STM32 --> <line x1="250" y1="390" x2="300" y2="250" stroke="#333" stroke-width="1.5"/> <text x="275" y="320" font-family="Arial" font-size="12" text-anchor="middle" fill="#333">PA5-PA8</text> <!-- LED指示灯连接到STM32 --> <line x1="650" y1="375" x2="500" y2="250" stroke="#333" stroke-width="1.5"/> <text x="575" y="320" font-family="Arial" font-size="12" text-anchor="middle" fill="#333">PB9-PB10</text> <!-- 电源连接 --> <line x1="400" y1="530" x2="400" y2="580" stroke="#333" stroke-width="1.5"/> <text x="400" y="560" font-family="Arial" font-size="12" text-anchor="middle" fill="#333">5V输入</text> <line x1="400" y1="530" x2="300" y2="200" stroke="#333" stroke-width="1.5"/> <line x1="400" y1="530" x2="200" y2="275" stroke="#333" stroke-width="1.5"/> <line x1="400" y1="530" x2="625" y2="290" stroke="#333" stroke-width="1.5"/> <line x1="400" y1="530" x2="200" y2="390" stroke="#333" stroke-width="1.5"/> <line x1="400" y1="530" x2="600" y2="375" stroke="#333" stroke-width="1.5"/> <!-- 接地符号 --> <path d="M400,580 L390,590 L400,600 L410,590" stroke="#333" stroke-width="1.5" fill="none"/> <!-- 组件详细说明 --> <text x="100" y="500" font-family="Arial" font-size="12" fill="#333">DS18B20连接: DQ-PA1, VCC-5V, GND-GND</text> <text x="100" y="520" font-family="Arial" font-size="12" fill="#333">LCD1602连接: DB0-DB7-PB0-PB7, RS-PB10, RW-PB11, E-PB12</text> <text x="100" y="540" font-family="Arial" font-size="12" fill="#333">按键连接: KEY1-KEY4-PA5-PA8, VCC-5V, GND-GND</text> <text x="100" y="560" font-family="Arial" font-size="12" fill="#333">LED连接: LED1-LED2-PB9-PB10, GND-GND</text> </svg>生成电路原理图
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值