B. Godsend

来源:互联网 发布:数据结构c语言课程设计 编辑:程序博客网 时间:2024/06/07 14:33
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
41 3 2 3
Output
First
Input
22 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.


水题,不要想复杂了。一开始是先取奇数,所以如果sum是奇数,就可以直接取完,如果sum是偶数的话,我们看看里面是不是有奇数,如果有奇数的话,肯定就是奇数赢了,因为剩下的是奇数,另外一个人只能是偶数,所以剩下的还是奇数,所以这样的话,就是奇数的赢。但是,如果里面没有奇数,就是偶数赢了。

#include <iostream>#include<stdio.h>#include<algorithm>#include<cmath>#include<map>#include<string.h>#define INF 0x3f3f3f3fusing namespace std;typedef long long ll;const int maxn=1e6+10;int num[maxn];int main(){   int n;   scanf("%d",&n);   int flag_odd=0;   ll sum=0;   for(int i=1;i<=n;i++)   {       scanf("%d",&num[i]);       sum += num[i];       if(num[i]%2!=0)        flag_odd=1;   }   if(sum%2==1||flag_odd)    printf("First\n");   else     printf("Second\n");   return 0;}


原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 月子过后脊背疼该怎么办 怀孕的时候牙疼怎么办 练瑜伽后弯腰疼怎么办 练完瑜伽腰椎疼怎么办 瑜伽开髋动作受伤怎么办 才学瑜伽教培上课紧张怎么办 瑜伽馆不给退费怎么办 脚运动后酸痛该怎么办 婴儿误吞拉链头怎么办 肠功能蠕动慢便秘怎么办 胃肠型和蠕动波怎么办 胃不蠕动了怎么办偏方 喂母乳母亲奶头裂开怎么办 给宝宝吃奶被吃到奶头裂开怎么办 宝宝吃奶奶头裂开了怎么办 小孩吃奶奶头裂开了怎么办 站久坐久腰酸痛怎么办 孕39周胎儿头小怎么办 怀孕腰两侧长肉怎么办 怀孕四个月半月吃点就饱怎么办啊 怀孕四个月睡眠不好怎么办 二胎七个月肚子太大怎么办 上火牙疼牙龈肿怎么办 孕30周乳房胀痛怎么办 怀孕长妊娠纹了怎么办 坐久了肚子胀疼怎么办 怀孕后胖的太快怎么办 怀孕牙齿全坏了怎么办 怀孕脸胖了好多怎么办 孕晚期不爱吃肉怎么办 怀孕期间胖了怎么办啊 孕期长得太胖怎么办 狗吃马肉脸肿了怎么办 狗过敏了脸肿了怎么办 孕初期外阴很痒怎么办 怀孕了吃了田鸡怎么办 孕妇睡眠质量差怎么办吃什么 39周2天了还不生怎么办 孕中期体重猛长怎么办 4个半月胎位不正怎么办 41周不产生宫缩怎么办