【Link】:http://codeforces.com/contest/841/problem/B

【Description】



两个人轮流对一个数组玩游戏,第一个人可以把连续的一段为奇数的拿走,第二个可以拿走偶数的.

谁无法拿就输.

问谁能赢

【Solution】



如果和为奇数的话,则第一个人赢.

否则

如果n个数中没有奇数,则第二个人赢,

如果n个数中有一个奇数,那么第一个人取走它,剩下的数字还是奇数,这时候第二个人无论取还是不取,都只能减少偶数的和,剩下的肯定是奇数的和,那么第一个人就能一次性取走剩下的了。

因此第一个人赢.



【NumberOf WA】



0



【Reviw】



有意思



【Code】

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define lson l,m,rt<<1
  4. #define rson m+1,r,rt<<1|1
  5. #define LL long long
  6. #define rep1(i,a,b) for (int i = a;i <= b;i++)
  7. #define rep2(i,a,b) for (int i = a;i >= b;i--)
  8. #define mp make_pair
  9. #define pb push_back
  10. #define fi first
  11. #define se second
  12. #define ms(x,y) memset(x,y,sizeof x)
  13. #define ri(x) scanf("%d",&x)
  14. #define rl(x) scanf("%lld",&x)
  15. #define rs(x) scanf("%s",x+1)
  16. #define oi(x) printf("%d",x)
  17. #define ol(x) printf("%lld",x)
  18. #define oc putchar(' ')
  19. #define os(x) printf(x)
  20. #define all(x) x.begin(),x.end()
  21. #define Open() freopen("F:\\rush.txt","r",stdin)
  22. #define Close() ios::sync_with_stdio(0)
  23. typedef pair<int,int> pii;
  24. typedef pair<LL,LL> pll;
  25. const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
  26. const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
  27. const double pi = acos(-1.0);
  28. const int N = 1e6;
  29. int n,odd;
  30. LL a[N+10];
  31. int main(){
  32. //Open();
  33. //Close();
  34. ri(n);
  35. rep1(i,1,n) {
  36. rl(a[i]);
  37. if (a[i]&1) odd = 1;
  38. }
  39. LL sum = 0;
  40. rep1(i,1,n){
  41. sum += a[i];
  42. }
  43. sum&=1;
  44. if (sum == 1){
  45. puts("First");
  46. }else{
  47. if (!odd){
  48. puts("Second");
  49. }else{
  50. puts("First");
  51. }
  52. }
  53. return 0;
  54. }

【Codeforces Round #429 (Div. 2) B】 Godsend的更多相关文章

  1. 【Codeforces Round #429 (Div. 2) A】Generous Kefa

    [Link]:http://codeforces.com/contest/841/problem/A [Description] [Solution] 模拟,贪心,每个朋友尽量地多给气球. [Numb ...

  2. 【Codeforces Round #429 (Div. 2) C】Leha and Function

    [Link]:http://codeforces.com/contest/841/problem/C [Description] [Solution] 看到最大的和最小的对应,第二大的和第二小的对应. ...

  3. 【Codeforces Round #429 (Div. 1) B】Leha and another game about graph

    [链接]点击打开链接 [题意] 给出一个连通图,并给每个点赋一个d值0或1或-1,要求选出一个边的集合,使得所有的点i要么d[i] == -1,要么  dgree[i] % 2 == d[i],dgr ...

  4. 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers

    [链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...

  5. 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes

    [题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...

  6. 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees

    [题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...

  7. 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory

    [题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...

  8. 【Codeforces Round #423 (Div. 2) C】String Reconstruction

    [Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...

  9. 【Codeforces Round #423 (Div. 2) B】Black Square

    [Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...

随机推荐

  1. koa 的 Context

    context上下文对象: 该对象类似原生http中的 req + res - 该对象的req,res属性也存在,就是原生没有包装过的req,res - 简单说: context 对象就是从请求到响应 ...

  2. 使用appium1.4在android8.0真机上测试程序时报错command failed shell "ps 'uiautomator'"的解决方式

    appium1.4,运行自动化脚本时提示 org.openqa.selenium.SessionNotCreatedException: A new session could not be crea ...

  3. Table边框合并

    <style> table, table tr th, table tr td { border: 1px solid #0094ff; } table { width: 200px; m ...

  4. 调试Android有什么错误

    项目目录的cmd调试查看有什么错误 gradlew processDebugManifest --stacktrace

  5. Repeatable Read

    在Repeatable Read隔离级别下,一个事务可能会遇到幻读(Phantom Read)的问题. 幻读是指,在一个事务中,第一次查询某条记录,发现没有,但是,当试图更新这条不存在的记录时,竟然能 ...

  6. Vue2.0源码思维导图-------------Vue 构造函数、原型、静态属性和方法

    已经用vue有一段时间了,最近花一些时间去阅读Vue源码,看源码的同时便于理解,会用工具画下结构图. 今天把最近看到总结的结构图分享出来.希望可以帮助和其他同学一起进步.当然里边可能存在一些疏漏的,或 ...

  7. (转)数字证书, 数字签名, SSL(TLS) , SASL

    转:http://blog.csdn.net/xueshanfeihu0/article/details/9154219 因为项目中要用到TLS + SASL 来做安全认证层. 所以看了一些网上的资料 ...

  8. XMPP的总体架构和Jabber ID

    通常XMPP的架构用C/S来实现,但是也并不是强制的,Client和Server,Server和Server之间通过TCP连接来通信. 架构的简单示意图如下: C1-----S1----S2----C ...

  9. anaconda里的python版本回退, requirements

    事情起因:我用的python3.7 , 同事机器学习的部分使用tensorflow,只支持python3.6, 所以我从3.7回退到3.6 conda create -n python36 pytho ...

  10. [转] Linux下编写脚本实现Daemon

    在Linux(以Redhat Linux Enterprise Edition 5.3为例)下,有时需要编写Service.Service也是程序,一般随系统启动用户不干预就不退出的程序,可以称为Se ...