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. win7访问部分win2003速度慢

    解决办法: 关闭TCPIP协议的自动优化调整功能,在win7上,以管理员身份运行cmd,输入 netsh interface tcp set global autotuninglevel=disabl ...

  2. 条款16:成对使用new和delete时要使用相同的形式

    请牢记: 如果在new表达式中使用[],必须在相应的delete表达式中也使用[]. new[]  对应  delete[] 如歌在new表达式中不适用[],一定不要在相应的delete表达式中使用[ ...

  3. 解决Nextcloud 无法删除目录

    1)进入维护模式 sudo -u www php /www/wwwroot/192.168.40.159/occ maintenance:mode --on 2)使用mysql命令行工具,在nextc ...

  4. .NET开发框架(二)-框架功能简述

    若视频播放不了,请点击 这里查看 本框架为响应式SPA框架,支持PC与手机端的屏幕自适应.手机展示效果视频在文章末尾查看. 框架入口地址:http://letyouknow.net/ 1.框架登录界面 ...

  5. Appium+python自动化(十一)- 元素定位秘籍助你打通任督二脉 - 下卷(超详解)

    简介 宏哥看你骨骼惊奇,印堂发亮,必是练武之奇才! 按照上一篇的节目预告,这一篇还是继续由宏哥给小伙伴们分享元素定位,是不是按照上一篇的秘籍修炼,是不是感觉到头顶盖好像被掀开,内气从头上冒出去,顿时觉 ...

  6. Python自学day-1

    一.Python介绍 1.python擅长领域:     WEB开发:Django. pyramid. Tornado. Bottle. Flask. WebPy     网络编程:Twisted(牛 ...

  7. Mint-ui全局引入

    1.Mint-ui在全局引入之后,在组件中使用其中的js函数,如toast() this.$toast('在全局引入之后可以直接在this.$toast中使用')

  8. Appium+python自动化(十三)- 与Capability完美懈垢之解读(超详解)

    简介 Capability又叫Appium Desired Capabilities,前边写了那么多实例代码,小伙伴可以发现一些规律,就是有一部分代码总是重复的出现在你的视线中.这部分就是对Capab ...

  9. 并发编程-concurrent指南-ConcurrentMap

    ConcurrentMap 是个接口,你想要使用它的话就得使用它的实现类之一. ConcurrentMap,它是一个接口,是一个能够支持并发访问的java.util.map集合: 在原有java.ut ...

  10. java 泛型?和T的区别

    泛型三种:          [1]ArrayList<T> al=new ArrayList<T>();指定集合元素只能是T类型          [2]ArrayList& ...