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?
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 answer in single line. "First", if first player wins, and "Second" otherwise (without quotes).
4 1 3 2 3
First
2 2 2
Second
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.
这一次的cf只A了一道题
rating哗哗的掉啊。。。。
第二题看错题意了啊。。。。。
本来是一个人取奇数,另一个人取偶数
结果我看成了两个人都取奇数。。。
不说了,都是泪。。
这题其实不难啦(当然还是让我想了一会儿的,毕竟博弈)
毕竟有样例的提示
首先如果所有的数加起来是奇数,那么肯定是First(第一个人全部拿走)
如果加起来是偶数的话
根据奇数+奇数=偶数
如果这n个数里存在奇数,那么奇数肯定得是偶数个的
所以我们只要先拿掉一些奇数
那么剩下的数的总和就是奇数了
无论player 2 如何操作
都只能拿偶数
所以不改变奇偶性
这样player 1只要再拿一次就win了
如果没有奇数就player 2 win啦
所以综上,只要有奇数就first
没有就second
#include<cstdio>
#include<cstring>
int read()
{
char t=getchar();
int ans=0;
while(t>'9'&&t<'0') t=getchar();
while(t<='9'&&t>='0') ans=ans*10+t-'0',t=getchar();
return ans;
}
int main()
{
bool f=0;
int n=read();
int x;
for(int i=1;i<=n&&!f;i++)
{
x=read();
if(x&1) f=1;
}
printf("%s",f?"First":"Second");
return 0;
}