time limit per test 2 seconds

memory limit per test 256 megabytes

input standard input

output standard output

Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an odd sum of numbers and remove it from the array, after that the remaining parts are glued together into one array and the game continues. The second player can choose a subsegment of non-zero length with an even sum and remove it. Loses the one who can not make a move. Who will win if both play optimally?

Input

First line of input data contains single integer n (1 ≤ n ≤ 106) — length of the array.

Next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 109).

Output

Output answer in single line. "First", if first player wins, and "Second" otherwise (without quotes).

Examples

input

4
1 3 2 3

output

First

input

2
2 2

output

Second

Note

In first sample first player remove whole array in one move and win.

In second sample first player can't make a move and lose.

【翻译】输入一个长度为n的序列,第一个人和第二个人轮流操作,第一个人先操作。第一个人可以取走和为奇数的连续一段,第二个人可以取走和为偶数的连续一段,但是不能不去。两人采取最优策略,最终谁会赢(第一个赢输出Fires,反之输出Second)。

题解:
         ①分类讨论就可以了:
               (1)如果整个序列和为奇数,那么开局First就胜利了。

               (2)如果整个序列和为偶数:
                     [1]如果这个序列没有奇数,那么First没法取,Second赢了。

                     [2]如果存在奇数,那么必会有偶数个奇数,那么First每次只消去一个奇数,到最后一定是他赢,因为Second始终没法消去奇数个奇数。

#include<stdio.h>
int main()
{
int n,sum=0,_=0,a;scanf("%d",&n);
while(n--)scanf("%d",&a),sum+=a,a&1?_=1:1;
puts(sum&1||_?"First":"Second");return 0;
}//Paul_Guderian

祝母校60岁生日快乐!———Rice_Rabbit

【CF Round 429 B. Godsend】的更多相关文章

  1. 【CF Round 434 A. k-rounding】

    Time limit per test1 second memory limit per test 256 megabytes input standard input output standard ...

  2. 【Codeforces Round #429 (Div. 2) B】 Godsend

    [Link]:http://codeforces.com/contest/841/problem/B [Description] 两个人轮流对一个数组玩游戏,第一个人可以把连续的一段为奇数的拿走,第二 ...

  3. 【CF Round 434 B. Which floor?】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  4. 【CF Round 439 E. The Untended Antiquity】

    time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standa ...

  5. 【CF Round 439 C. The Intriguing Obsession】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  6. 【CF Round 439 B. The Eternal Immortality】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  7. 【CF Round 439 A. The Artful Expedient】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  8. 【Codeforces Round #429 (Div. 2) A】Generous Kefa

    [Link]:http://codeforces.com/contest/841/problem/A [Description] [Solution] 模拟,贪心,每个朋友尽量地多给气球. [Numb ...

  9. 【Codeforces Round #429 (Div. 1) B】Leha and another game about graph

    [链接]点击打开链接 [题意] 给出一个连通图,并给每个点赋一个d值0或1或-1,要求选出一个边的集合,使得所有的点i要么d[i] == -1,要么  dgree[i] % 2 == d[i],dgr ...

随机推荐

  1. Exception occurred during processing request: The given object has a null identifier: com.zsn.crm.Model.SaleVisit; nested exception is org.hibernate.TransientObjectException: The given object has a nu

    edit.jsp页面没有加入隐藏字段 id ,导致模型驱动封装时缺少id ,,调用update更新数据库时出错!

  2. MyBatis单列工厂的实现

    MyBatis单列工厂的实现 SqlSessionFactoryUtils package com.utils; import org.apache.ibatis.io.Resources; impo ...

  3. centos下LVM配置与管理

    centos下LVM配置与管理 LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层, ...

  4. tomcat 无论如何都无法创建新的Servers

    1.退出eclipse 2.到[工程目录下 workspace ]/.metadata/.plugins/org.eclipse.core.runtime 3.把org.eclipse.wst.ser ...

  5. iOS常用控件-UITableViewCell

    一. 封装cell: 1.加载xib文件的两种方式 <方式1> (NewsCell是xib文件的名称) NSArray *objects = [[NSBundle mainBundle] ...

  6. 使用.gitignore忽视项目中的文件/文件夹

    在项目开发的过程中,我们经常需要IDE来提高编程效率.然而,不同的IDE会生成各种各样的临时文件.在项目生命周期中,我们往往不需要关注这类文件的变更记录,因而我们是不需要将它们加入到源代码管理器中. ...

  7. mac上MySQLdb问题解决

    早上有个同学问题python访问mysql的问题,之前的写得脚步突然不能运行了,找了很多文章总算解决问题了O(∩_∩)O哈哈~,希望下次不要浪费这么多时间搞这么坑的问题了.   mac上MySQLdb ...

  8. 3 web框架

    web框架 Web框架(Web framework)是一种开发框架,用来支持动态网站.网络应用和网络服务的开发.这大多数的web框架提供了一套开发和部署网站的方式,也为web行为提供了一套通用的方法. ...

  9. cocos2d-x 3.0环境配置(转)

    cocos2d-x 3.0发布有一段时间了,作为一个初学者,我一直觉得cocos2d-x很坑.每个比较大的版本变动,都会有不一样的项目创建方式,每次的跨度都挺大…… 但是凭心而论,3.0RC版本开始 ...

  10. 10 class封装 ORM

    1.版本1:初始化 # -*- coding:utf-8 -*- from MySQLdb import * class MysqlHelper: def __init__(self,host,por ...