http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1011&cid=594

Key Set

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

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
 
直接输出2的n-1次方-1?当然2的10的9次方的次方肯定很大,然而结果只是对其求余与1000000007,所以快速幂,对每次都求余,就不会超出类型啦
 #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const LL mod = ;
LL Pow (LL x, LL y)
{
LL ans = ;
while (y)
{
if (y % )
ans = ans * x % mod;
x = x * x % mod;
y /= ;
}
return ans;
}
int main ()
{
LL t, n;
scanf ("%lld", &t);
while (t --)
{
scanf ("%lld", &n);
LL ans = Pow (, n-);
printf ("%lld\n", ans-);
}
return ;
}

Key Set的更多相关文章

  1. Key/Value之王Memcached初探:二、Memcached在.Net中的基本操作

    一.Memcached ClientLib For .Net 首先,不得不说,许多语言都实现了连接Memcached的客户端,其中以Perl.PHP为主. 仅仅memcached网站上列出的语言就有: ...

  2. Dapper.Contrib:GetAsync<T> only supports an entity with a [Key] or an [ExplicitKey] property

    异常处理:http://www.cnblogs.com/dunitian/p/4523006.html#dapper 原来Model是这样滴 修改后是这样滴 注意点:Model里面的Table和Key ...

  3. Redis百亿级Key存储方案(转)

    1 需求背景 该应用场景为DMP缓存存储需求,DMP需要管理非常多的第三方id数据,其中包括各媒体cookie与自身cookie(以下统称supperid)的mapping关系,还包括了supperi ...

  4. 【详细教程】论android studio中如何申请百度地图新版Key中SHA1值

    一.写在前面 现在越来越多的API接口要求都要求提供我们的项目SHA1值,开发版目前还要求不高,但是发布版是必定要求的.而目前定位在各大APP中也较为常见,当下主流的百度地图和高德地图都在申请的时候会 ...

  5. CentOS:ECDSA host key "ip地址" for has changed and you have requested strict checking(转)

    原文地址:http://blog.csdn.net/ausboyue/article/details/52775281 Linux SSH命令错误:ECDSA host key "ip地址& ...

  6. webstorm license key

    JetBrains WebStorm注册码 UserName: William License Key : ===== LICENSE BEGIN ===== 45550-12042010 00001 ...

  7. VS2015企业版本(安装包+key)+ .NET Reflector 9.0

    Reflector9.0系下载:https://yunpan.cn/cMQj9zWbffSqy  访问密码 55eb VS2015中文企业版: http://pan.baidu.com/s/1eRIo ...

  8. Redis系列之key操作命令与Redis中的事务详解(六)

    序言 本篇主要目的有二: 1.展示所有数据类型中key的所有操作命令,以供大家学习,查阅,更深入的挖掘redis潜力. 2.掌握redis中的事务,让你的数据完整性一致性拥有更优的保障. redis命 ...

  9. SQL Server-聚焦移除Bookmark Lookup、RID Lookup、Key Lookup提高SQL查询性能(六)

    前言 前面几节都是讲的基础内容,本节我们讲讲索引性能优化,当对大数据进行处理时首先想到的就是索引,一旦遇到这样的问题则手忙脚乱,各种查资料,为何平常不扎实基本功呢,我们由浅入深,简短的内容,深入的理解 ...

  10. 创建SSH Key连接github或gitlab

    mac下用SoureceTree下载github或gitlab上的项目时,需要进行ssh key验证.每次重装系统啥的都要重新弄,我在csdn上看到一篇不错的文章.转载一下,以后自己找起来也方便. 地 ...

随机推荐

  1. IsAjaxRequest

    具体来说,IsAjaxRequest代码可以分解为以下功能: public static bool IsAjaxRequest(this HttpRequestBase request) { if ( ...

  2. JSP表单提交 与 接受显示

    Demo01.jsp 提交表单输入的信息至 Demo02.jsp方法一 1 <%@ page language="java" contentType="text/h ...

  3. CSS基础--属性选择器、伪类选择器

    属性选择器 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  4. 去JQUERY化

    时间 2016-05-17 12:43:59  OurJS 原文  http://ourjs.com/detail/573a9cec88feaf2d031d24fc 主题 jQuery 这是一篇使用原 ...

  5. python 转义json串

    import re body=r''' {"id":${BXbiztripinfoID_10},"msg":"1234测试审批${__UUID}&qu ...

  6. 《JAVA设计模式》之代理模式(Proxy)

    在阎宏博士的<JAVA与模式>一书中开头是这样描述代理(Proxy)模式的: 代理模式是对象的结构模式.代理模式给某一个对象提供一个代理对象,并由代理对象控制对原对象的引用. 代理模式的结 ...

  7. Linux文件目录可视化远程软件winscp的使用

    这个软件不是必须的,一般有命令行就可以操作文件目录,但winscp有图形界面,双击文件就可以编辑和保存,使用方式更接近windows Winscp是开源软件,安装包可以自行下载获取找有关人士获取 要新 ...

  8. 64-基于TMS320C6455、XC5VSX95T 的6U CPCI无线通信处理平台

    基于TMS320C6455.XC5VSX95T 的6U CPCI无线通信处理平台   1. 板卡概述 本板卡由我公司自主研发,基于CPCI架构,符合PICMG2.0 D3.0标准,包含双TI TMS3 ...

  9. 从__name__=='__main__'说到__builtin__

    一.__name__ 我们在写好代码进行自测的时候一般会先写这样一行代码: # inter_method if __name__ == '__main__': 为什么呢,可能并不是所有人都考虑过,这个 ...

  10. Linux 下源码安装ngnix

    版本说明: NGINX 版本1.12.0 pcre-8.40 zlib-1.2.11 openssl-1.1.0i   安装过程 # ./configure  --prefix=/usr/ngnix  ...