您的位置:首页 > 编程语言 > Go语言

Codeforces 841 B Godsend

2017-08-19 23:31 459 查看
题目地址

题意:给你n个数,有两个人去取数(可以取多个),第一个人的取数规则是取出的数的和为奇数,第二个人的取数规则是取出的数的和为偶数,如果有人去不了了就是另一个人赢了。

思路:有两种条件,一种全部数的和为奇数,那明显是第一个人赢了,直接全部取走就好了。第二种就是全部数的和为偶数,那第一个人先取奇数(如果有),剩下的和是奇数,第二个人也取不了,所以当n个数中有奇数的话,肯定是第一个人赢了。

#include <iostream>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdio>
#include <algorithm>
#define N 3010
#define LL __int64
#define inf 0x3f3f3f3f
#define lson l,mid,ans<<1
#define rson mid+1,r,ans<<1|1
#define getMid (l+r)>>1
#define movel ans<<1
#define mover ans<<1|1
using namespace std;
const LL mod = 1e9 + 7;
map<char, int> mapp;
int main() {
cin.sync_with_stdio(false);
int n, m;
while (cin >> n) {
for (int i = 0; i < n; i++) {
cin >> m;
if (m % 2) {
cout << "First" << endl;
return 0;
}
}
cout << "Second" << endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: