ural 2068 - Game of Nuts 博弈水题
2016-08-23 12:07
483 查看
题意:给出n个奇数,每个大于1的奇数又可以分解成三个奇数,Daenerys先分,最先不能继续分的输,问谁赢。
每个数字x总能分解x/2次,把可以分解的总次数加起来判断奇偶就可以了。
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main() {
int n, i, a;
while(~scanf("%d", &n)) {
int ans = 0;
while(n--) {
scanf("%d", &a);
ans += a / 2;
}
if(ans & 1)
printf("Daenerys\n");
else printf("Stannis\n");
}
return 0;
}
每个数字x总能分解x/2次,把可以分解的总次数加起来判断奇偶就可以了。
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main() {
int n, i, a;
while(~scanf("%d", &n)) {
int ans = 0;
while(n--) {
scanf("%d", &a);
ans += a / 2;
}
if(ans & 1)
printf("Daenerys\n");
else printf("Stannis\n");
}
return 0;
}
相关文章推荐
- URAL2068:Game of Nuts(博弈)
- URAL 2068 Game of Nuts(博弈)
- URAL 2068 Game of Nuts (博弈)
- URAL 1023 Buttons(巴什博弈水题)
- URAL 2056 Scholarship 水题
- HDU 5973 Game of Taking Stones 博弈+高精度
- ural 1014【水题,不过有点阴人】
- URAL 1877 Bicycle Codes 水题
- POJ 2068 Nim 博弈DP
- URAL1001 - Reverse Root - 水题
- HDU 5973 Game of Taking Stones (威佐夫博弈+高精度)
- Ural-1001. Reverse Root(水题)
- UVA - 10891 Game of Sum 区间DP(博弈DP)
- (博弈DP) poj 2068
- lightoj 1020 (博弈水题)
- URAL - 1018 (树形dp 水题)
- poj 2068 Nim(博弈dp)
- 【博弈 && dfs】URAL 2104 Game with a Strip
- nimk博弈的一道水题--SDNU OJ 1253
- URAL 1902 Neo-Venice(水题)