1. 程式人生 > >CSU 2018年12月月賽 H(2220): Godsend

CSU 2018年12月月賽 H(2220): Godsend

Description

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 ≤ 1000000) — length of the array.

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

Output

Output answer in single line.

"First", if first player wins, and "Second" otherwise (without quotes).

Sample Input

4
1 3 2 3

Sample Output

First

題意:給你n個數,第一個人能刪去一個連續的子串當且只當這個連續子串所有數之和為奇數,同理第二個人刪的是和為偶數的子串,誰不能操作了誰輸。考慮這個總串和為偶數的情況,因為為奇數的時候第一個人直接全刪了。
   當總和為偶數的時候,如果所有的數都是偶數的話,第一個人就沒有辦法刪了,所以第二個人贏,不然那第一個先刪去一段子串,剩餘的子串之和肯定為奇數。第二個人刪去偶數,肯定不能全刪了,剩餘的肯定是奇數,
   那麼第一個人必贏。綜上,只有所有的數都是偶數的時候第二個人才贏,否則第一個人贏 。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
const int maxn=230;
int n,x,temp;
string s;
int main()
{
    cin>>n;
    bool flag=false;
    while(n--)
    {
        scanf("%d",&x);
        if(x%2)
            flag=true;
    }
    if(flag==false)
        cout<<"Second"<<endl;
    else
        cout<<"First"<<endl;
    return 0;
}

/**********************************************************************
    Problem: 2220
    User: therang
    Language: C++
    Result: AC
    Time:256 ms
    Memory:2020 kb
**********************************************************************/