题意:给定 n 堆石子,每次一个人把它们分成三堆都是奇数的,谁先不能分,谁输。

析:因为每堆都是奇数,那么最后肯定都是要分成1的,那么就把不是1的全加和,然后判断奇偶就OK了。

代码如下:

  1. #pragma comment(linker, "/STACK:1024000000,1024000000")
  2. #include <cstdio>
  3. #include <string>
  4. #include <cstdlib>
  5. #include <cmath>
  6. #include <iostream>
  7. #include <cstring>
  8. #include <set>
  9. #include <queue>
  10. #include <algorithm>
  11. #include <vector>
  12. #include <map>
  13. #include <cctype>
  14. #include <cmath>
  15. #include <stack>
  16. #define frer freopen("in.txt", "r", stdin)
  17. #define frew freopen("out.txt", "w", stdout)
  18. using namespace std;
  19.  
  20. typedef long long LL;
  21. typedef pair<int, int> P;
  22. const int INF = 0x3f3f3f3f;
  23. const double inf = 0x3f3f3f3f3f3f;
  24. const double PI = acos(-1.0);
  25. const double eps = 1e-8;
  26. const int maxn = 8;
  27. const int mod = 1e9 + 7;
  28. const char *mark = "+-*";
  29. const int dr[] = {-1, 0, 1, 0};
  30. const int dc[] = {0, 1, 0, -1};
  31. int n, m;
  32. const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  33. const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  34. inline int Min(int a, int b){ return a < b ? a : b; }
  35. inline int Max(int a, int b){ return a > b ? a : b; }
  36. inline LL Min(LL a, LL b){ return a < b ? a : b; }
  37. inline LL Max(LL a, LL b){ return a > b ? a : b; }
  38. inline bool is_in(int r, int c){
  39. return r >= 0 && r < n && c >= 0 && c < m;
  40. }
  41.  
  42. int main(){
  43. while(scanf("%d", &n) == 1){
  44. int ans = 0;
  45. for(int i = 0; i < n; ++i){
  46. scanf("%d", &m);
  47. if(m > 2)
  48. ans += m/2;
  49. }
  50. if(ans % 2 == 0) puts("Stannis");
  51. else puts("Daenerys");
  52. }
  53. return 0;
  54. }

  

URAL 2068 Game of Nuts (博弈)的更多相关文章

  1. ural 2068. Game of Nuts

    2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...

  2. Timus 2068. Game of Nuts 解题报告

    1.题目描述: 2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still i ...

  3. POJ 2068 Nim#双人dp博弈

    http://poj.org/problem?id=2068 #include<iostream> #include<cstdio> #include<cstring&g ...

  4. URAL 1180. Stone Game (博弈 + 规律)

    1180. Stone Game Time limit: 1.0 second Memory limit: 64 MB Two Nikifors play a funny game. There is ...

  5. POJ 2068 NIm (dp博弈,每个人都有特定的取最大值)

    题目大意: 有2n个人,从0开始编号,按编号奇偶分为两队,循环轮流取一堆有m个石子的石堆,偶数队先手,每个人至少取1个,至多取w[i]个,取走最后一个石子的队伍输.问偶数队是否能赢. 分析: 题目数据 ...

  6. poj 2068 Nim(博弈dp)

    Nim Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1403   Accepted: 791 Description Le ...

  7. URAL - 1397:Points Game (博弈,贪心)

    Two students are playing the following game. There are 2· n points on the plane, given with their co ...

  8. Ural State University Internal Contest October'2000 Junior Session

    POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7 ...

  9. URAL2104. Game with a Strip(博弈)

    There is a strip 1 × n with two sides. Each square of the strip (their total amount is 2n, n squares ...

随机推荐

  1. MVC+Ef项目(2) 如何更改项目的生成顺序;数据库访问层Repository仓储层的实现

    我们现在先来看看数据库的生成顺序   居然是 Idal层排在第一,而 web层在第二,model层反而在第三 了   我们需要把 coomon 公用层放在第一,Model层放在第二,接下来是 Idal ...

  2. mac下编译optool方法

    参考地址:http://www.mopsled.com/2016/build-optool-osx/ 1.git clone https://github.com/alexzielenski/opto ...

  3. 2015-10-09 Fri 晴 加快进度看书

    最近老感觉每天不够用,每天7点起来,吃饭完了8点开始看书,不知道是我看书太慢了还是时间过得真的很快,不知不觉中午就到了.而这个时候我才看2章的内容,下午能多看3章内容.一本书也就一天的时候,而我现在还 ...

  4. 《Unix网络编程》卷2 读书笔记 第1章-简介

    1. 概述 2. 进程.线程与信息共享 Unix进程间的信息共享有多种方式:注意下图中内核的位置   左边的两个进程共享存留于文件系统中某个文件上的某些信息.为访问这些信息,每个进程都得穿越内核. 中 ...

  5. Java自增原子性问题(测试Volatile、AtomicInteger)

    这是美团一面面试官的一个问题,后来发现这是一道面试常见题,怪自己没有准备充分:i++;在多线程环境下是否存在问题?当时回答存在,接着问,那怎么解决?...好吧,我说加锁或者synchronized同步 ...

  6. dubbo-admin在jdk 1.8上部署出错问题

    今天在linux上部署dubbo-admin-2.5.4,一直报错: ERROR context.ContextLoader - Context initialization failedorg.sp ...

  7. c# datagridview表格控件常用操作

    1) 行右键菜单 private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { ...

  8. getHibernateTemplate() 一直报NullPointerException 错误

    原来是调用方法有误正确调用方法: ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContex ...

  9. 嵌入式 Linux下编译并使用curl静态库

    #x86 ./configure --disable-shared --enable-static --disable-ftp --disable-ipv6 --disable-rtsp --disa ...

  10. Multi-Device Hybrid Apps for Visual Studio CTP2.0

    http://msdn.microsoft.com/en-us/library/dn771545.aspx http://www.microsoft.com/en-us/download/detail ...