You are given an array aa consisting of nn integers.

In one move, you can choose two indices 1≤i,j≤n1≤i,j≤n such that i≠ji≠j and set ai:=ajai:=aj . You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is the operation of assignment (i.e. you choose ii and jj and replace aiai with ajaj ).

Your task is to say if it is possible to obtain an array with an odd (not divisible by 22 ) sum of elements.

You have to answer tt independent test cases.

Input

The first line of the input contains one integer tt (1≤t≤20001≤t≤2000 ) — the number of test cases.

The next 2t2t lines describe test cases. The first line of the test case contains one integer nn (1≤n≤20001≤n≤2000 ) — the number of elements in aa . The second line of the test case contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤20001≤ai≤2000 ), where aiai is the ii -th element of aa .

It is guaranteed that the sum of nn over all test cases does not exceed 20002000 (∑n≤2000∑n≤2000 ).

Output

For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise.

Example
Input

 
5
2
2 3
4
2 2 8 8
3
3 3 3
4
5 5 5 5
4
1 1 1 1
Output

 
YES
NO
YES
NO
NO
读入时统计奇数和偶数的个数,奇数个数为0一定不行,只有偶数个奇数也一定不行,其他情况都可以。
#include <bits/stdc++.h>
using namespace std;
int t;
int main()
{
cin>>t;
while(t--)
{
int n;
cin>>n;
int i;
int ji=,ou=;
for(i=;i<=n;i++)
{
int temp;
scanf("%d",&temp);
if(temp%==)ou++;
else ji++;
}
if(ji==)
{
cout<<"NO"<<endl;
continue;
}
if(ou==&&ji%==)
{
cout<<"NO"<<endl;
continue;
}
cout<<"YES"<<endl;
}
return ;
}

Codeforces Round #617 (Div. 3)A. Array with Odd Sum(水题)的更多相关文章

  1. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  2. Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题

    C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just re ...

  3. Codeforces Round #185 (Div. 2) A. Whose sentence is it? 水题

    A. Whose sentence is it? Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

  4. Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题

    A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...

  5. Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题

    A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...

  6. Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题

    B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...

  7. Codeforces Round #310 (Div. 2) B. Case of Fake Numbers 水题

    B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  8. Codeforces Round #309 (Div. 2) B. Ohana Cleans Up 字符串水题

    B. Ohana Cleans Up Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/554/pr ...

  9. Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks 字符串水题

    A. Kyoya and Photobooks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

随机推荐

  1. python的scribe client

    在网上找了一个python的scribe client使用方法 依赖的模块: pip install facebook-scribe pip install thrift 代码例子: #!/usr/b ...

  2. angular 页面中引入静态 PDF 文件

    在web开发时我们有时会需要在线预览PDF内容,在线嵌入pdf文件 常用的几种PDF预览代码片段如下: 方法一: <object type="application/pdf" ...

  3. Python的几种主动结束程序方式

    1. sys.exit() 执行该语句会直接退出程序,这也是经常使用的方法,也不需要考虑平台等因素的影响,一般是退出Python程序的首选方法. 该方法中包含一个参数status,默认为0,表示正常退 ...

  4. mybatis用mysql数据库自增主键,插入一条记录返回新增记录的自增主键ID

    今天在敲代码的时候遇到一个问题,就是往数据库里插入一条记录后需要返回这个新增记录的ID(自增主键), 公司框架用的是mybatis的通用Mapper接口,里面的插入方法貌似是不能把新纪录的ID回填到对 ...

  5. sublime不支持ascill编码办法

    1.按下组合键ctrl+shift+p,输入:install package,回车 2.在弹出的安装包框中搜索:ConvertToUTF8或者GBK Encoding Support,选择点击安装: ...

  6. Windows系统重装记录

    材料: u盘(需4g以上) windows官方镜像 附:windows个版本比较 步骤: u盘格式化(为了装启动盘系统需要清空数),备份系统盘所需要的的数据 下载适合自己的官方镜像,可从该网站下载(官 ...

  7. 原生JS实现旋转木马轮播图特效

    大概是这个样子: 首先来简单布局一下(emm...随便弄一下吧,反正主要是用js来整的) <!DOCTYPE html> <html lang="en"> ...

  8. CentOS7.6配置ip

    查看CentOS版本信息 [root@localhost ~]# cat /etc/redhat-release CentOS Linux release (Core) 配置ip [root@loca ...

  9. Arrays.asList() 踩坑

    该方法是将  数组转化为list,但转换后的list集合,不支持add 和 remove 代码如下: 阅读相关: 本类演示了Arrays类中的asList方法 (1) 该方法对于基本数据类型的数组支持 ...

  10. 【PAT甲级】1083 List Grades (25 分)

    题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...