Codeforces 841 B Godsend
2017-08-19 23:31
459 查看
题目地址
题意:给你n个数,有两个人去取数(可以取多个),第一个人的取数规则是取出的数的和为奇数,第二个人的取数规则是取出的数的和为偶数,如果有人去不了了就是另一个人赢了。
思路:有两种条件,一种全部数的和为奇数,那明显是第一个人赢了,直接全部取走就好了。第二种就是全部数的和为偶数,那第一个人先取奇数(如果有),剩下的和是奇数,第二个人也取不了,所以当n个数中有奇数的话,肯定是第一个人赢了。
题意:给你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; }
相关文章推荐
- Codeforces_841_B Godsend(思路|简单博弈)
- Codeforces 841 CLeha and Function
- Codeforces-429-2-B Godsend
- Godsend CodeForces - 841B 博弈
- Codeforces_841_C Leha and Function(贪心+构造|规律)
- Codeforces 841 Generous Kefa(模拟)
- Codeforces 337D 树形dp + 小技巧
- codeforces 337A Puzzles
- Codeforces-891B Gluttony 思维题
- 【CodeForces】Round #270 A,B,C,D题解
- codeforces 612A The Text Splitting(扩展欧几里得)
- CodeForces 668A Little Artem and Matrix
- Codeforces 465C No to Palindromes!【暴力+思维】
- CodeForces 347C Alice and Bob
- CodeForces - 898C Phone Numbers STL
- Codeforces 911E Stack Sorting (模拟)
- codeforces 之 Design Tutorial: Learn from Life
- Codeforces Good Bye 2015 A. New Year and Days 水题
- CodeForces 24B-F1 Champions
- CodeForces 652E|Pursuit For Artifacts|边双连通分量|缩点