题目连接:hdu 1850 Being a Good Boy in Spring Festival
题目大意:略。
解题思路:Nim和判断是否必胜。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 105;
int n, sg, c, arr[maxn];
int main () {
while (scanf("%d", &n) == 1 && n) {
sg = c = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
sg ^= arr[i];
}
for (int i = 0; i < n; i++) {
int tmp = sg ^ arr[i];
if (arr[i] > tmp)
c++;
}
printf("%d\n", c);
}
return 0;
}
分享到:
相关推荐
很好很经典的组合博弈的讲义,HDU 大家下来看看很好
HDU的1250,主要是利用高精度加法,但是代码有点繁琐,效率不是很高
杭电ACMhdu1163
hdu1001解题报告
HDU1059的代码
hdu 1574 passed sorce
HDU的一题........HDU DP动态规
现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。 Input 本题目包含多组测试数据,请处理到文件结束。 每一组测试数据在一行里面包含两个长度不大于400的正小数A和B。 Output 请在一行里面...
hdu2101AC代码
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
搜索 dfs 解题代码 hdu1241
hdu 5007 Post Robot 字符串枚举。 暴力一下就可以了。
hdu acm 教案 动态规划(1) hdu acm 教案 动态规划(1)
hdu_2102_passed_sorce
自己做的HDU ACM已经AC的题目
hdu 1166线段树代码
HDU最全ac代码
hdu动态规划算法集锦
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105. Input Input...