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. zynqmp(zcu102rev1.0)系列---1---安装 xsdk

    Xilinx 的zynq7020在设备上面已经使用上,并量产,关于zynq7020使用总结将在近期同步进行. 该系列主要记录Xilinx zynqmp系列 的使用以及在遇到的问题.目前手上有一块dem ...

  2. 【Qt】无边框窗体中带有ActiveX组件时的一个BUG

    无意中发现的一个BUG,Qt5.1.1正式版首先创建一个GUI工程,拖入一个QAxWidget控件(为了使ActiveX生效,需要在.pro文件中加入CONFIG += qaxcontainer)接着 ...

  3. FreeCL

    FreeCL 1.03(Free Control Library)是一个开源且免费的Windows控件库,它属于3D图形引擎FreeGE中的一部分,用户可以自由地用于个人或商业开发.FreeCL使用类 ...

  4. 预编译加速编译(precompiled_header),指定临时文件生成目录,使项目文件夹更干净(MOC_DIR,RCC_DIR, UI_DIR, OBJECTS_DIR),#pragma execution_character_set("UTF-8")"这个命令是在编译时产生作用的,而不是运行时

    预编译加速编译 QT也可以像VS那样使用预编译头文件来加速编译器的编译速度.首先在.pro文件中加入: CONFIG += precompiled_header 然后定义需要预编译的头文件: PREC ...

  5. 多线程基础理论--C#

    1.主线程 进程创建时,默认创建一个线程,这个线程就是主线程.主线程是产生其他子线程的线程,同时,主线程必须是最后一个结束执行的线程,它完成各种关闭其他子线程的操作.尽管主线程是程序开始时自动创建的, ...

  6. Codility---Dominator

    Task description A zero-indexed array A consisting of N integers is given. The dominator of array A ...

  7. java高级知识

    1. Spring读取配置文件的流程,怎样引入注解? 2. Spring是怎么注入新的java文件的? 3. CAS锁是什么实现机制,在java的哪些包里最常使用?什么情况下会使用CAS锁? 4. 线 ...

  8. openstack namespace 的应用

    查看虚拟机网络连通性 1.neutron port-list | grep IP 2.neutron port-show ID 查看subnet 3.neutron subnet-show ID 查看 ...

  9. Java8新特性——lambda表达式.(案例:完全数分类)

    需求:输入一个数,判断其类型(完全数,过剩数,不足数) 完全数:自身之外所有因数和==自身 过剩数:自身之外所有因数和>自身 不足数:自身之外所有因数和<自身 package cn._3. ...

  10. ajax入门级

    AJAX AJAX:即异步的JavaScript 和 XML,是一种用于创建快速动态网页的技术: 传统的网页(不使用AJAX)如果需要更新内容,必需重载整个网页面: 使用AJAX则不与要加载更新整个网 ...