AcWing 891. Nim游戏&&892.台阶-Nim游戏&&893. 集合-Nim游戏
发布日期:2021-05-12 17:09:06 浏览次数:16 分类:精选文章

本文共 1911 字,大约阅读时间需要 6 分钟。

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������C++���������������

������������

#include 
using namespace std;
int main(void) {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int t;
cin >> t;
res ^= t;
}
if (res) cout << "Yes";
else cout << "No";
}

������������

#include 
#include
using namespace std;
const int N = 100010;
int main() {
int n;
scanf("%d", &n);
int res = 0;
while (n--) {
int x;
scanf("%d", &x);
res ^= x;
}
if (res) puts("Yes");
else puts("No");
return 0;
}

���������������������������������������������������������������������������Yes���������No������������������1���������n���������������������������������������������n���������1������������������������������������������scanf���

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������NIM������������������������while(n--)���������������������������n������0���������NIM���������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

上一篇:Acwing 868. 筛质数 欧拉筛模板、埃氏筛模板
下一篇:Acwing 503. 借教室

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月29日 07时29分57秒