Codeforces841B
B. Godsend
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.
水了一天。。。
//2017-08-22
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; const int N = ;
int arr[N]; int main()
{
int n;
std::ios::sync_with_stdio(false);
while(cin>>n){
long long sum = ;
int odd = , even = ;
for(int i = ; i < n; i++){
cin>>arr[i];
sum += arr[i];
if(arr[i]&)odd++;
else even++;
}
if(sum & )cout<<"First"<<endl;
else{
if(odd == )cout<<"Second"<<endl;
else cout<<"First"<<endl;
}
} return ;
}
Codeforces841B的更多相关文章
随机推荐
- jzoj4512
01分數規畫 我們可以二分一個ans,然後化一下式子 一個總共有k個人的方案,要使(a[1]+a[2]+....+a[k])/(b[1]+b[2]+....+b[k])>=ans(a[1]+a[ ...
- springboot常用注解
@SpringBootApplication:包含了@ComponentScan.@Configuration和@EnableAutoConfiguration注解.其中@ComponentScan让 ...
- Swift 里 Array (三) Inspecting an Array
判断是否为空 使用的是Collection协议里isEmpty的判断. public var isEmpty: Bool { return startIndex == endIndex } start ...
- ASP.NETCore学习记录(一)
ASP.NETCore学习记录(一) asp.net core介绍 Startup.cs ConfigureServices Configure 0. ASP.NETCore 介绍 ASP.N ...
- vue教程1-07 模板和过滤器
vue教程1-07 模板和过滤器 一.模板 {{msg}} 数据更新模板变化 {{*msg}} 数据只绑定一次 {{{msg}}} HTML转意输出 <!DOCTYPE html> < ...
- 关于如何食用Xcode——用mac的小蒟蒻
前言QwQ 对于一只用Mac的小蒟蒻,没有Dev_c++简直太难受了,用在线IDE写代码又没法保存,那么我们怎么办呢? 好在App Store里有这个好东西 所以我们今天来介绍一下 “如何使用Xcod ...
- JDK提供的四种线程池代码详解
一.线程池什么时候使用,会给我们带来什么好处? 如果很多用户去访问服务器,用户访问服务器的时间是非常短暂的,那么有可能在创建线程和销毁线程上花费的时间会远远大于访问所消耗的时间,如果采用线程池会使线程 ...
- (转)Linux PS 详解
原文:https://cn.aliyun.com/jiaocheng/162702.html 摘要:原文地址:http://www.cnblogs.com/wangkangluo1/archive/2 ...
- unittest单元测试框架简单说明
unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果.今天笔者 ...
- Android之apk优化
公司的apk越做越大...作为一个有追求的程序员,我觉得有必要给apk瘦身了... 优化之前,先来分析一下apk结构,下面附上一张apk结构图: apk结构.png 由于我这个项目集成了百度地图.百度 ...