题目:

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.

题意:给出一个数组,有两个人玩游戏,游戏规则:第一个人选取连续的子区间并且区间的和为奇数,第二个人选取连续的子区间并且区间和为偶数。当有人不能选择这样的一个区间时,那么这个人就输了,问那个人会赢?

思路:思维题。容易看出,当存在一个奇数的时候第一个人会赢,否则第二个人会赢。另奇数的个数为x,当x为偶数时,第一个人只需选取最后一个奇数前的区间,那么无论第二个人怎么选都会存在和为奇数的区间;当x为奇数时,此时整个数组的和为奇数满足条件,第一个人直接选择整个数组~

code:

#include<bits/stdc++.h>
using namespace std;
int a[1000005];
int main()
{int n,i,x;while(~scanf("%d",&n)){x=0;for(i=0;i<n;i++){scanf("%d",&a[i]);if(a[i]%2) x++;}if(x) puts("First");else puts("Second");}return 0;
}

Codeforces Round #429 (Div. 2):B. Godsend相关推荐

  1. CodeForces 840C - On the Bench | Codeforces Round #429 (Div. 1)

    思路来自FXXL中的某个链接 /* CodeForces 840C - On the Bench [ DP ] | Codeforces Round #429 (Div. 1) 题意:给出一个数组,问 ...

  2. 2463: [中山市选2009]谁能赢呢? Codeforces Round #429 (Div. 2) B. Godsend noip三国游戏...

    Description 小明和小红经常玩一个博弈游戏.给定一个n×n的棋盘,一个石头被放在棋盘的左上角.他们轮流移动石头.每一回合,选手只能把石头向上,下,左,右四个方向移动一格,并且要求移动到的格子 ...

  3. Codeforces Round #429 (Div. 2) B. Godsend

    Problem - B - Codeforces 题意: 给定一个数列,先手可以remove一段区间和为奇数的区间,后手可以remove一段区间和为偶数的区间,问你赢家是谁? 思路: 博弈题按状态的思 ...

  4. Codeforces Round #292 (Div. 2):C. Drazil and Factorial

    题意:令F(i)为i的每一位数字阶乘积,例如F(931) = 9!*3!*1! 给你一个a,找到最大的x满足F(x) = F(a),并且要求x中不能出现数字1和0 9! = 7!*3!*3!*2! 8 ...

  5. Codeforces Round #493 (Div. 2):D. Roman Digits

    题意(转换后):给你一个n,问在满足x+y+a+b=n的情况下,x+5y+10a+50b有多少种不同的结果 结论:当n≤11的时候直接暴力,n≥12满足F(i)=F(i-1)+49 思路:假设有这样道 ...

  6. Codeforces Round #493 (Div. 2):C. Convert to Ones

    题意:给你一个01串,你有两种操作:①翻转某个子串,代价为x:②将某个子串的0和1全部取反,代价为y,求将整个串全部修改成1的最小代价 思路:如果全为1,直接输出0,否则假设有p个连"0&q ...

  7. Codeforces Round #164 (Div. 2):B. Buttons

    题意:给你一个有n个按钮的密码锁,n个按钮编号1~n,你必须按照正确的顺序依次按下它们,如果当前你按下的按钮是正确的,那么这个按钮就会被压下去,如果按错,那么所有已经被压下去的按钮就会全部弹出,例如n ...

  8. Codeforces Round #366 (Div. 1):Ant Man(贪心)

    B. Ant Man time limit per test 4 seconds memory limit per test 256 megabytes input standard input ou ...

  9. Codeforces Round #429 Div. 1

    A:甚至连题面都不用仔细看,看一下样例就知道是要把大的和小的配对了. #include<iostream> #include<cstdio> #include<cmath ...

最新文章

  1. golang goroutine 协程同步 sync.WaitGroup 简介
  2. CENTOS MINI版安装tomcat9.0
  3. 敏捷开发方法学及应用
  4. java调用其他方法中的变量_Uipath中调用Python的方法
  5. 关键词词云怎么做_制作CVPR 热词云(并爬取pdf地址 名称)
  6. GTADIR check object exist in another system
  7. mysql必须的组件_mysql innodb的重要组件
  8. go语言代码规范详解
  9. 构建一套高逼格 Nginx 集群监控系统!
  10. java实现调查问卷_智能办公进行时丨富士施乐邀您参与有奖问卷调查
  11. 分数换算小数补0法_小学数学常用公式大全(单位换算表),替孩子收藏一份...
  12. 如何选择APP内测分发平台?五年开发者亲述
  13. halcon与python混编_halcon与C#混编的入门贴
  14. day 54 django-图书管理系统_出版社的管理(展示,新增,删除,编辑)
  15. 安裝打印機或者掃描器驅動時,出現「unknown device」(不明裝置)的提示,怎麼辦?...
  16. 中科蓝汛----指示灯配置使用方法
  17. Microsoft Visual C++ 和 Borland C++ Builder 之比较
  18. IIS下防止mdb数据库被下载的实现方法
  19. Parcelable和Bundle介绍
  20. vim中文教程-来自官方文档

热门文章

  1. 最新织梦仿冷轩资源网模板(善恶资源网、新版小刀娱乐网模板)
  2. 计算机毕业设计Java中小企业人力资源管理系统(源码+系统+mysql数据库+lw文档)
  3. 设计一个课程类,包括课程编号、课程名称、任课教师、上课地点等属性,把上课地点变量设为私有的,增加构造方法和显示课程信息的方法。
  4. 【毕业前夕,畅谈科研】2000-2010,大学-硕士-博士[转]
  5. 傅立叶变换--复数到底是个什么东西?
  6. win8系统设置杜比音效的详细步骤--win7w.com
  7. 使用PD协议分析仪调试Type-C PD兼容性
  8. 批量分析京东详细物流情况,并筛选拒收的单号
  9. java休眠5s_java定时5s
  10. TransGAN代码复现—九天毕昇平台