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. Windows+Idea安装Hadoop开发环境

    前言:这种问题,本来不应该写篇博客的,但是实在是折磨我太久了,现在终于修好了,必须记一下,否则对不起自己的时间,对自己的博客道歉 *** 简介 环境:Windows 10+JDK1.8+Intelli ...

  2. OpenSSL的命令行用法,以及参数大全

    c:\openssl\bin>opensslOpenSSL> versionOpenSSL 1.0.2j 26 Sep 2016OpenSSL> https://wiki.opens ...

  3. Qt通过HTTP POST上传文件(python做服务端,附下载)

    本文使用Qt Creator用HTTP POST的方法上传文件,并给出一个上传文件的例程. 本文主要客户端,所以对于服务器端程序编写的描述会比较简略 服务器使用Django编写,django服务器接收 ...

  4. Qt第三方圆形进度条-及其改进

    Qt第三方圆形进度条的改进 要实现一个圆形的进度条功能,在网上找到一个比较出名的第三方封装类:QRoundProgressBar,地址:sourceforge 的 QRoundProgressBar  ...

  5. kube框架结构-一个小型响应式CSS框架

    当你开始初建一个新的项目时,你可能需要一个不太复杂的基础框架,Kube框架应该是你最好的选择.一个独立的CSS文件,帮助你更简单的创建响应式的的布局设计. Kube Framework包括网格.按钮. ...

  6. 创业游戏模拟器 Startup 游戏试玩

    买的正版游戏,还在beta阶段.因为对这种经营类的游戏挺感兴趣,结合自己也是做这个行当的.算是一次性通关了吧.我来评价一下这个游戏.足足玩了有5个多小时.从1级玩到15级.解锁了所有的内容.员工从1个 ...

  7. uni-app中vue组件父子值传递

    一.父组件向子组件传递数据(props) <template> <view class="container" style="background: # ...

  8. kubernetes之使用http rest api访问集群

    系列目录 在Kubernetes集群中,API Server是集群管理API的入口,由运行在Master节点上的一个名为kube-apiserver的进程提供的服务. 用户进入API可以通过kubec ...

  9. nice-validator表单验证插件的简单使用

    前言 前端表单校验是过滤无效数据.假数据.有毒数据的第一步,是数据安全的第一道关卡,虽然我们不能100%相信客户端提交的数据(真正的校验还得在服务端进行),但设置前端表单校验也是至关重要的,自己写逻辑 ...

  10. 分享Nginx在Windows下的管理命令(bat文件)

    话不多说,复制下面的内容,存成bat文件,放到nginx目录下. ====================================================@echo offrem 当前 ...