Por Costel and Azerah

Descriptions

给你n个数 问你,有多少个子序列 的和是偶数

Example

Input
2
3
3 10 1
2
4 2
Output
3
3
题目链接
 
恶心死了  

freopen("azerah.in","r",stdin);
freopen("azerah.out","w",stdout);

必须加上 不然一直错  卡了我1小时

直接看代码吧 挺水的

AC代码

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 1000010
using namespace std;
ll T,n;
int main()
{
freopen("azerah.in","r",stdin);
freopen("azerah.out","w",stdout);
cin>>T;
while(T--)
{
cin>>n;
ll x;
ll n1=;//奇数个数
ll n2=;//偶数个数
for(ll i=; i<=n; i++)
{
cin>>x;
if(x%)
n1++;
else
n2++;
}
ll s1=;//奇数中的偶数子序列个数=2^(s1-1)-1
ll s2=;//偶数中的偶数子序列个数=2^s2-1
//怕溢出,就一步一步循环吧
for(ll i=; i<=n2; i++)
{
s1*=;
s1%=Mod;
}
for(ll i=; i<n1; i++)
{
s2*=;
s2%=Mod;
}
s1--;
s2--;
cout<<(s1+s2+s1*s2)%Mod<<endl;
}
return ;
}

【Gym - 100923A】Por Costel and Azerah(思维水题)的更多相关文章

  1. 【动态规划】Gym - 100923A - Por Costel and Azerah

    azerah.in / azerah.out Por Costel the Pig has received a royal invitation to the palace of the Egg-E ...

  2. 【Heap-dijkstra】Gym - 100923B - Por Costel and the Algorithm

    algoritm.in / algoritm.out Even though he isn't a student of computer science, Por Costel the pig ha ...

  3. 【找规律】Gym - 100923L - Por Costel and the Semipalindromes

    semipal.in / semipal.out Por Costel the pig, our programmer in-training, has recently returned from ...

  4. 【分块打表】Gym - 100923K - Por Costel and the Firecracker

    semipal.in / semipal.out Por Costel the pig, our programmer in-training, has recently returned from ...

  5. 【数形结合】Gym - 100923I - Por Costel and the Pairs

    perechi3.in / perechi3.out We don't know how Por Costel the pig arrived at FMI's dance party. All we ...

  6. 【并查集】Gym - 100923H - Por Costel and the Match

    meciul.in / meciul.out Oberyn Martell and Gregor Clegane are dueling in a trial by combat. The fight ...

  7. HDU 2674 N!Again(数学思维水题)

    题目 //行开始看被吓一跳,那么大,没有头绪, //看了解题报告,发现这是一道大大大的水题,,,,,//2009 = 7 * 7 * 41//对2009分解,看它有哪些质因子,它最大的质因子是41,那 ...

  8. HDOJ/HDU 1256 画8(绞下思维~水题)

    Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...

  9. 2019年华南理工校赛(春季赛)--I--炒股(简单思维水题)

    水题,想想就过了 题目如下: 链接:https://ac.nowcoder.com/acm/contest/625/I来源:牛客网 攒机一时爽,一直攒机一直爽. 沉迷攒机的胡老师很快就发现,他每天只能 ...

随机推荐

  1. DBShop 电子商务网店系统

    DBShop 电子商务网店系统,采用业界知名框架 ZendFramework 2 开发而成. 下面为功能简介 1.在线更新:在线系统更新和在线模板安装与更新,简单.方便.快捷,省却了手动更新的繁琐步骤 ...

  2. Qt使Release版本可调试

    只需在pro文件中加入 QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$ ...

  3. Qt发展历史及其特点简介(没有哪一种方案能够独霸Windows)

    Qt 是一个跨平台的C++应用程序框架,支持Windows.Linux.Mac OS X.Android.iOS.Windows Phone.嵌入式系统等.也就是说,Qt 可以同时支持桌面应用程序开发 ...

  4. 最近公共祖先(least common ancestors algorithm)

    lca问题是最近公共祖先问题,一般是针对树结构的.现在有两种方法来解决这样的问题 1. On-line algorithm 用比较长的时间做预处理.然后对每次询问进行回答. 思路:对于一棵树中的两个节 ...

  5. Spring单例模式多线程安全问题-有状态的Bean

    Spring单例与线程安全小结 一.Spring单例模式与线程安全 Spring框架里的bean,或者说组件,获取实例的时候都是默认的单例模式,这是在多线程开发的时候要尤其注意的地方. 单例模式的意思 ...

  6. Ubuntu --- 【转】安装lamp(php7.0)

    本篇转自:http://www.laozuo.org/8303.html.以防丢失,再次记录 PHP7已经出来有一段时间,根据网友的实践测试比之前的版本效率会高不少,而且应用到网站中打开速度会有明显的 ...

  7. Java NIO: Non-blocking Server 非阻塞网络服务器

    本文翻译自 Jakob Jenkov 的 Java NIO: Non-blocking Server ,原文地址:http://tutorials.jenkov.com/java-nio/non-bl ...

  8. 编译php扩展

    在php编译安装好的情况下php扩展编译 php的很多模块都是以php的扩展形式来进行的.所以在php安装好的环境下需要用到之前安装时没有编译安装的php扩展的时候,这个时候编译安装php扩展就显得尤 ...

  9. Windows 命令行文本操作

    Windows下文件操作,大部分的时候用的都是用Windows 资源管理器(就是双击 “我的电脑” 的时候看到的图形界面). 接下来,以Windows命令行下操作文本为例,看看命令行在操作文件方面有多 ...

  10. 可用的NTP服务器地址

    国内可用的Internet时间同步服务器地址(NTP时间服务器)好在阿里云提供了7个NTP时间服务器也就是Internet时间同步服务器地址 ntp1.aliyun.comntp2.aliyun.co ...