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. 网页头部ico 不显示

    这个都是很基础的东西,.今天整理以前的笔记,看到了记录一下 <link rel="shortcut icon" href="/favicon.ico"/& ...

  2. 简单了解,使用oracle中的索引,表分区

    索引的分类 如下: 物理分类 逻辑分类 分区或非分区索引 单列或组合索引 B树索引(标准索引) 唯一或非唯一索引 正常或反向键索引 基于函数索引 位图索引   B树索引 b树索引通常也称为标准索引,索 ...

  3. (servlet页面跳转没有反应)

    问题:页面跳转到/UserManager/LoginCLServlet,就一直没有反应,无法继续执行下去(servlet页面跳转没有反应) 解决: doPost()方法里面必须写成这样 正确的写法:  ...

  4. Redis 持久化操作

    hash类型 类比:mysql数据库存储数据 持久化操作 以本身的数据以文件形式保存到硬盘中 手动快照持久化 i 备份机制(频率) vi redis.conf save 900 1  900s如果一个 ...

  5. JavaSE 第二次学习随笔(一)

    Java是一种区分大小写的强类型准动态语言 动态语言,是指程序在运行时可以改变其结构:新的函数可以被引进,已有的函数可以被删除等在结构上的变化,类型的检查是在运行时做的,优点为方便阅读,清晰明了,缺点 ...

  6. linux-shell——04

    mv 移动文件或者目录 格式:mv [选项]      源文件/目录     目标文件/目录 注:若移动目标位置与源位置相同(当前下操作),则此操作相当于重命名(改名) ex: [root@local ...

  7. https://www.cnblogs.com/gaoxiang12/p/3695962.html

    https://www.cnblogs.com/gaoxiang12/p/3695962.html

  8. 2018Ec-Final比赛总结

    一场匆忙的旅程. NCC_9754_ Victory的最后一场比赛终究没能victory. 去的时候晕车到吐了两次,到宾馆吃完饭直接睡了,但还是两天都昏昏沉沉的头疼的厉害,第二天直接步行去了西工大体育 ...

  9. 12-optionBinding

    1-创建一个空的dotnet mvc网站 2- 创建appsettings.json文件, 这文件会默认被绑定 { "ClassNo": "1", " ...

  10. python-11多线程

    1-多任务可以由多进程完成,也可以由一个进程内的多线程完成. 1.1多线程代码示例 import time, threading def loop(): print("thread %s i ...