URAL 2068 Game of Nuts (博弈)
2016-08-22 19:46
381 查看
题意:给定 n 堆石子,每次一个人把它们分成三堆都是奇数的,谁先不能分,谁输。
析:因为每堆都是奇数,那么最后肯定都是要分成1的,那么就把不是1的全加和,然后判断奇偶就OK了。
代码如下:
析:因为每堆都是奇数,那么最后肯定都是要分成1的,那么就把不是1的全加和,然后判断奇偶就OK了。
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <queue> #include <algorithm> #include <vector> #include <map> #include <cctype> #include <cmath> #include <stack> #define frer freopen("in.txt", "r", stdin) #define frew freopen("out.txt", "w", stdout) using namespace std; typedef long long LL; typedef pair<int, int> P; const int INF = 0x3f3f3f3f; const double inf = 0x3f3f3f3f3f3f; const double PI = acos(-1.0); const double eps = 1e-8; const int maxn = 8; const int mod = 1e9 + 7; const char *mark = "+-*"; const int dr[] = {-1, 0, 1, 0}; const int dc[] = {0, 1, 0, -1}; int n, m; const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; inline int Min(int a, int b){ return a < b ? a : b; } inline int Max(int a, int b){ return a > b ? a : b; } inline LL Min(LL a, LL b){ return a < b ? a : b; } inline LL Max(LL a, LL b){ return a > b ? a : b; } inline bool is_in(int r, int c){ return r >= 0 && r < n && c >= 0 && c < m; } int main(){ while(scanf("%d", &n) == 1){ int ans = 0; for(int i = 0; i < n; ++i){ scanf("%d", &m); if(m > 2) ans += m/2; } if(ans % 2 == 0) puts("Stannis"); else puts("Daenerys"); } return 0; }
相关文章推荐
- URAL 2068 Game of Nuts(博弈)
- URAL2068:Game of Nuts(博弈)
- ural 2068 - Game of Nuts 博弈水题
- ACM中的博弈论入门(四)POJ 2068 动态规划处理的博弈
- URAL 1180. Stone Game (博弈 + 规律)
- HDU 5953 Game of Taking Stones(威佐夫博弈+高精度+二分)——The 2016 ACM-ICPC Asia Dalian Regional Contest
- URAL - 2068
- POJ 2068 Nim 博弈DP
- HDU 5973 Game of Taking Stones 威佐夫博弈+大数
- URAL 1180. Stone Game (博弈 + 规律)
- ural 1087. The Time to Take Stones(博弈)
- POJ 2068 NIM (博弈DP)
- poj 2068 NIM 博弈+dp
- URAL1928(博弈dp)
- URAL 1023 Buttons(巴什博弈水题)
- HDU 5973-Game of Taking Stones(威佐夫博弈-JAVA BigDecimal)
- HDU 5973-Game of Taking Stones(威佐夫博弈
- UVA - 10891 Game of Sum 区间DP(博弈DP)
- ural 1923 Another Ecology Problem(博弈dp)
- URAL 2068. Game of Nuts