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 }
  • 相关阅读:
    sql注入的防护
    mysql及sql注入
    机器学习之新闻文本分类。
    python导入各种包的方法——2
    爬去搜狐新闻历史类
    前端展示
    热词分析前端设计
    爬虫经验总结二
    爬虫经验总结一
    SpringBoot配置Druid数据库连接池
  • 原文地址:https://www.cnblogs.com/Penn000/p/7413627.html
Copyright © 2011-2022 走看看