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. QT 强制杀死进程

    bool KillProcess(QString ProcessName){  bool result = false; QString str1; HANDLE hSnapShot = Create ...

  2. DataVeryLite和Nhibernate性能对比

    电脑型号:acer 4752g 电脑配置: 代码分享: class Program { static void Main(string[] args) { Debug.Listeners.Add(ne ...

  3. java基础第十三篇之Collection

    常见的几种数据结构: * 1.堆栈:先进后出 * 2.队列:先进先出 * 3.数组:查找快,增删慢 * 4.链表:查找慢,增删快  import java.util.LinkedList; /* * ...

  4. 高并发 Nginx+Lua OpenResty系列(2)——Nginx Lua API

    Nginx Lua API 和一般的Web Server类似,我们需要接收请求.处理并输出响应.而对于请求我们需要获取如请求参数.请求头.Body体等信息:而对于处理就是调用相应的Lua代码即可:输出 ...

  5. 推荐三个学习git的网站或教程

    廖雪峰官方教程:https://www.liaoxuefeng.com/wiki/896043488029600/900388704535136 ProGit中文版:https://git-scm.c ...

  6. 为什么建议大家使用 Linux 开发

    Linux 能用吗? 我身边还有些朋友对 linux 的印象似乎还停留在黑乎乎的命令行界面上.当我告诉他或者建议他使用 linux 时,会一脸惊讶的问我,那个怎么用(来开发或者日常使用)? Linux ...

  7. Docker中使用CentOS7镜像

    因后面会将操作系统从CentOS6.4升级到CentOS7,先试用下CentOS7. 启动容器服务 systemctl start docker.service 下载CentOS7 镜像   [roo ...

  8. 浅谈block, inline和inline-block的区别

    block 块元素    inline 内联元素 常见的块元素有:div, p, h1~h6, table, form, ol, ul等 常见的内联元素有:span, a, strong, em, l ...

  9. 从零到一,利用kubeadm在ubuntu server 16.04 64位系统离线安装kubernetes v1.10.0

    说明 初步接触kubernets,记录学习过程 本教程目的利用kubeadm在ubuntu server 16.04 64位系统离线安装kubernets v1.10.0 环境信息 节点IP地址 角色 ...

  10. 公司倒闭 1 年了,而我当年的项目上了 GitHub 热榜

    公司倒闭 1 年多了,而我在公司倒闭时候做的开源项目,最近却上了 GitHub Trending,看着这个数据,真是不胜唏嘘. 缘起 2017 年 11 月份的时候,松哥所在的公司因为经营不善要关门了 ...