Codeforces Round #439 A The Artful Expedient 博弈解释 +暴力写法
来源:互联网 发布:分类汇总数据复制出来 编辑:程序博客网 时间:2024/06/03 13:16
毕竟是 A 题,直接两重循环就可以暴力过去。。
按博弈想的话就是 : ai ^ aj = ak 的话,那么可以推出 : ai ^ ak = aj 和 aj ^ ak = ai ;
没有重复的元素,如果能在已有集合中找到一个 ai ^ bj 满足条件的话,那这个异或后的数(假设为 c ) 也会有 (ai ^ c = bj )或者 (bj ^ c = ai) ,两种情况中的一种,
也就是说符合情况的两个数异或然后结果肯定是成对出现的 所以答案一定是 Karen 赢
暴力写法如下:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#include <sstream>#define PI acos(-1.0)#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)using namespace std;typedef long long ll;const int maxn = 20000000 + 7, INF = 0x7f7f7f7f, mod = 1e9 + 7;int n;int vis[maxn] = {0}, a[2222], b[2222];int main() { //cout << (3^2) << endl; scanf("%d", &n); int cnt = 0; for(int i = 0; i < n; ++i) { scanf("%d", &a[i]); vis[a[i]] = 1; } for(int i = 0 ; i < n; ++i) { scanf("%d", &b[i]); vis[b[i]] = 1; } for(int i = 0; i < n; ++i) { for(int j = 0; j < n; ++j) { if(vis[(a[i]^b[j])]) cnt++; } } if(cnt % 2 == 0) puts("Karen"); else puts("Koyomi"); return 0;}
阅读全文
1 0
- Codeforces Round #439 A The Artful Expedient 博弈解释 +暴力写法
- Codeforces Round #439 (Div. 2) A. The Artful Expedient
- Codeforces Round #439 (Div. 2) A. The Artful Expedient
- Codeforces Round #439 (Div. 2) A. The Artful Expedient
- Codeforces Round #439 (Div. 2) The Artful Expedient
- Codeforces Round #439 (Div. 2) The Artful Expedient
- codeforces 869A The Artful Expedient
- Codeforces 869A. The Artful Expedient
- Codeforces 869A The Artful Expedient
- CodeForces 869A The Artful Expedient
- A. The Artful Expedient
- A. The Artful Expedient
- codeforces—— 869A —— The Artful Expedient
- Codeforces869A The Artful Expedient
- 【codeforces869A】The Artful Expedient
- codeforces The Artful Expedient(数学思维题)
- CF 869 A. The Artful Expedient【异或】
- CF 869 A. The Artful Expedient(异或)
- C和C++字符串删除等特定操作处理
- Vision_字符串_AC自动机
- BOS系统的设计与实现
- codeforces 868C Qualification Rounds
- 8. 适配器模式
- Codeforces Round #439 A The Artful Expedient 博弈解释 +暴力写法
- 二分查找
- Hibernate的持久化对象状态
- python里使用正则的finditer()函数
- mysql服务器无法连接10055错误解决示例
- FTPrep, 106 Construct Binary Tree from Inorder and Postorder Traversal
- JAVA提高篇(17)--打印流PrintStream记录日志文件
- Codeforces869C The Intriguing Obsession
- SecureCRT8.0安装与破解