Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?

Given an integer sequence a1, a2, ..., an of length n. Decide whether it is possible to divide it into an odd number of non-empty subsegments, the each of which has an odd length and begins and ends with odd numbers.

A subsegment is a contiguous slice of the whole sequence. For example, {3, 4, 5} and {1} are subsegments of sequence{1, 2, 3, 4, 5, 6}, while {1, 2, 4} and {7} are not.

Input

The first line of input contains a non-negative integer n (1 ≤ n ≤ 100) — the length of the sequence.

The second line contains n space-separated non-negative integers a1, a2, ..., an (0 ≤ ai ≤ 100) — the elements of the sequence.

Output

Output "Yes" if it's possible to fulfill the requirements, and "No" otherwise.

You can output each letter in any case (upper or lower).

Examples
input
3
1 3 5
output
Yes
input
5
1 0 1 5 1
output
Yes
input
3
4 3 1
output
No
input
4
3 9 9 3
output
No
Note

In the first example, divide the sequence into 1 subsegment: {1, 3, 5} and the requirements will be met.

In the second example, divide the sequence into 3 subsegments: {1, 0, 1}, {5}, {1}.

In the third example, one of the subsegments must start with 4 which is an even number, thus the requirements cannot be met.

In the fourth example, the sequence can be divided into 2 subsegments: {3, 9, 9}, {3}, but this is not a valid solution because 2 is an even number.

题意:把集合分成奇数个,里面的元素也为奇数个,能不能分,当然不破坏顺序

解法:

1 偶数个是没有的

2 奇数个我们只要首尾一个奇数就行

 #include<bits/stdc++.h>
using namespace std;
int x[];
int main(){
int n;
cin>>n;
for(int i=;i<=n;i++){
cin>>x[i];
}
if(n%){
if(x[]%&&x[n]%){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}else{
cout<<"No"<<endl;
}
return ;
}

Codeforces Round #431 (Div. 2) A的更多相关文章

  1. Codeforces Round #431 (Div. 1)

    A. From Y to Y time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. Codeforces Round #431 (Div. 2) C. From Y to Y

    题目: C. From Y to Y time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  3. Codeforces Round #431 (Div. 2)

    A. Odds and Ends Where do odds begin, and where do they end? Where does hope emerge, and will they e ...

  4. Codeforces Round #431 (Div. 2) C

    From beginning till end, this message has been waiting to be conveyed. For a given unordered multise ...

  5. 【Codeforces Round #431 (Div. 1) D.Shake It!】

    ·最小割和组合数放在了一起,产生了这道题目. 英文题,述大意:     一张初始化为仅有一个起点0,一个终点1和一条边的图.输入n,m表示n次操作(1<=n,m<=50),每次操作是任选一 ...

  6. 【Codeforces Round 431 (Div. 2) A B C D E五个题】

    先给出比赛地址啦,感觉这场比赛思维考察非常灵活而美妙. A. Odds and Ends ·述大意:      输入n(n<=100)表示长度为n的序列,接下来输入这个序列.询问是否可以将序列划 ...

  7. Codeforces Round #431 (Div. 2) B. Tell Your World

    B. Tell Your World time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  8. 【推导】【分类讨论】Codeforces Round #431 (Div. 1) B. Rooter's Song

    给你一个这样的图,那些点是舞者,他们每个人会在原地待ti时间之后,以每秒1m的速度向前移动,到边界以后停止.只不过有时候会碰撞,碰撞之后的转向是这样哒: 让你输出每个人的停止位置坐标. ①将x轴上初始 ...

  9. 【推导】【贪心】Codeforces Round #431 (Div. 1) A. From Y to Y

    题意:让你构造一个只包含小写字母的可重集,每次可以取两个元素,将它们合并,合并的代价是这两个元素各自的从‘a’到‘z’出现的次数之积的和. 给你K,你构造的可重集必须满足将所有元素合而为一以后,所消耗 ...

  10. Codeforces Round #431 (Div. 2) B

    Connect the countless points with lines, till we reach the faraway yonder. There are n points on a c ...

随机推荐

  1. BZOJ 3410 [Usaco2009 Dec]Selfish Grazing 自私的食草者:贪心【最多线段覆盖】

    题目链接:http://begin.lydsy.com/JudgeOnline/problem.php?id=1324 题意: 给你n个区间,问你最多能选择多少个区间使得它们不相互覆盖. 题解: RQ ...

  2. javascript(5)

    (1)数组的细节: 基本用法 var 数组名=[元素值,元素值...]; 元素的值可以是任意类型. 数组是引用类型. js里的引用. 在函数参数列表中,如果传入的是基本类型,那 按值传递.如果传入的是 ...

  3. WEB攻击之 CSRF 攻击及防御策略

    介绍 是一种挟制用户在当前已登录的Web应用程序上执行非本意的操作的攻击方法. 释义: 跨站请求攻击,简单地说,是攻击者通过一些技术手段欺骗用户的浏览器去访问一个自己曾经认证过的网站并运行一些操作(如 ...

  4. 1080 Graduate Admission (30)(30 分)

    It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applicat ...

  5. hadoop之一:概念和整体架构

    什么是hadoop? Apache Hadoop是一款支持数据密集型分布式应用并以Apache 2.0许可协议发布的开源软件框架.它支持在商品硬件构建的大型集群上运行的应用程序.Hadoop是根据Go ...

  6. Iptables防火墙面试题

    Iptables防火墙面试题 第1章 (一)基础口试题 1.1 详述 iptales 工作流程以及规则过滤顺序? 1.防火墙是一层层过滤的.实际是按照配置规则的顺序从上到下,从前到后进行过滤的. 2. ...

  7. 10 Vue 学习 shortList页面

    1: shortList页面代码如下: <template> <div class="fillcontain"> <head-top></ ...

  8. [hdu4405]Aeroplane chess(概率dp)

    题意:某人掷骰子,数轴上前进相应的步数,会有瞬移的情况,求从0到N所需要的期望投掷次数. 解题关键:期望dp的套路解法,一个状态可以转化为6个状态,则该状态的期望,可以由6个状态转化而来.再加上两个状 ...

  9. django根据不同app配置相应的log文件

    django根据不同app配置相应的log文件 settings.py # django logging LOG_PATH = "/var/log/blog/" LOGGING = ...

  10. celery和supervisor配合使用,实现supervisor管理celery进程

    在这里我选择redis作为celery异步任务的中间人,系统选择CentOS6.5 64位.redis.celery和supervisor的安装参见官方文档. 安装完毕后: 1, 创建celery的实 ...