zoukankan      html  css  js  c++  java
  • Codeforces841B

    B. Godsend

    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.

     水了一天。。。

     1 //2017-08-22
     2 #include <cstdio>
     3 #include <cstring>
     4 #include <iostream>
     5 #include <algorithm>
     6 
     7 using namespace std;
     8 
     9 const int N = 1000010;
    10 int arr[N];
    11 
    12 int main()
    13 {
    14     int n;
    15     std::ios::sync_with_stdio(false);
    16     while(cin>>n){
    17         long long sum = 0;
    18         int odd = 0, even = 0;
    19         for(int i = 0; i < n; i++){
    20               cin>>arr[i];
    21             sum += arr[i];
    22             if(arr[i]&1)odd++;
    23             else even++;
    24         }
    25         if(sum & 1)cout<<"First"<<endl;
    26         else{
    27             if(odd == 0)cout<<"Second"<<endl;
    28             else cout<<"First"<<endl;
    29         }
    30     }
    31 
    32     return 0;
    33 }
  • 相关阅读:
    Atitit 数据库view视图使用推荐规范与最佳实践与方法
    Atitit mybatis快速开发 的sql api接口
    一个数据包经过路由器和交换机各会发生什么变化
    c preprocessor
    A database of opensource HTTP proxies written in python.
    google chrome os下载
    一道笔试题多字串查找
    一个老题:将正整数n分为若干num个不同的正整数之和
    web dev framework
    memory leakage
  • 原文地址:https://www.cnblogs.com/Penn000/p/7413627.html
Copyright © 2011-2022 走看看