Codeforces Round #617 (Div. 3)A. Array with Odd Sum(水题)
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.
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 ).
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.
5
2
2 3
4
2 2 8 8
3
3 3 3
4
5 5 5 5
4
1 1 1 1
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(水题)的更多相关文章
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- 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 ...
- 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/ ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- 每天进步一点点------SOPC的Avalon-MM IP核(二) AVALON总线的IP核定制
简介 NIOS II是一个建立在FPGA上的嵌入式软核处理器,除了可以根据需要任意添加已经提供的外设外,用户还可以通过定制用户逻辑外设和定制用户指令来实现各种应用要求.这节我们就来研究如何定制基于Av ...
- 【做题笔记】P2251 质量检测
一看题就知道是线段树裸题了.可是,对于每个 \(i\) ,对应的 \(Q\) 序列的下标是多少呢?应该查询的区间又是什么呢? 找规律: \(i\ \ \ \ \ \ \ \ m\) \(1\ \Rig ...
- quernation,euler,rotationmatrix之间的相互转换
转自:https://blog.csdn.net/zhuoyueljl/article/details/70789472
- Fluent_Python_Part1序幕,01-data-model, 数据模型
01-data-model/frenchdeck.py 1. Python解释器碰到特殊的句法时,会使用__特殊方法__去激活一些基本的对象操作. 特殊方法的存在是为了被解释器用的.没有my_obje ...
- wireshark抓本地包
# wireshark抓本地包 1. wireshark抓本地包 windows系统没有提供本地回环网络的接口,用wireshark监控网络的话只能看到经过网卡的流量,看不到访问localhost的流 ...
- Chrome无法从该网站添加应用,扩展程序和用户脚本
#开始 更新谷歌浏览器之后发现不能通过本地 crx文件安装离线插件了 网上找到的方法有两种 一个就是通过添加浏览器参数解决 但是这个方法我尝试之后失败了 第二个方法就是用工具安装 具体如何太麻烦了就没 ...
- 【PAT甲级】1092 To Buy or Not to Buy (20 分)
题意: 输入两行字符串,如果第二行字符串包含于第一行字符串,输出"Yes"以及第一行字符串减去第二行字符串剩余的字符个数,否则输出"No"以及第二行字符串中不在 ...
- input file multiple 配合springmvc实现多文件上传
.前端页面的样子 <input id="file" name="file" type="file" multiple="mu ...
- Git管理代码
使用Git管理代码 1. 分支管理模式 首先,master分支应该是非常稳定的,开发都在dev分支上,每个人都有自己的分支,时不时地往dev分支上合并就可以了.完成测试后,再把dev分支合并到mast ...
- 虚拟机中安装centos7后无法上网,使用桥接网络+ssh
首先是桥接网络解决无法上网的问题: 1保证你Vmware里面的虚拟机是关机状态2右键点击电脑屏幕右下角小电脑图标,选择打开网络与共享中心,然后点击弹出来的窗口左上角的“更改适配器设置”.这里指的是你W ...