题目描述:
Rock… Paper!

After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows.

A positive integer n is decided first. Both Koyomi and Karen independently choose n distinct positive integers, denoted by x1, x2, …, xn and y1, y2, …, yn respectively. They reveal their sequences, and repeat until all of 2n integers become distinct, which is the only final state to be kept and considered.

Then they count the number of ordered pairs (i, j) (1 ≤ i, j ≤ n) such that the value xi xor yj equals to one of the 2n integers. Here xor means the bitwise exclusive or operation on two integers, and is denoted by operators ^ and/or xor in most programming languages.

Karen claims a win if the number of such pairs is even, and Koyomi does otherwise. And you’re here to help determine the winner of their latest game.
输入描述:
The first line of input contains a positive integer n (1 ≤ n ≤ 2 000) — the length of both sequences.

The second line contains n space-separated integers x1, x2, …, xn (1 ≤ xi ≤ 2·106) — the integers finally chosen by Koyomi.

The third line contains n space-separated integers y1, y2, …, yn (1 ≤ yi ≤ 2·106) — the integers finally chosen by Karen.

Input guarantees that the given 2n integers are pairwise distinct, that is, no pair (i, j) (1 ≤ i, j ≤ n) exists such that one of the following holds: xi = yj; i ≠ j and xi = xj; i ≠ j and yi = yj.
输出描述:
Output one line — the name of the winner, that is, “Koyomi” or “Karen” (without quotes). Please be aware of the capitalization.
输入:
3
1 2 3
4 5 6
5
2 4 6 8 10
9 7 5 3 1
输出:
Karen
Karen
题意:
上面的数和下一个数两两组合, 每一个组合中 如果异或后的值 在输入中出现过.ans++,ans为偶数Karen赢,反之另一位赢…
题解
a^b=c;
a^ c = a^ b ^a=b;
所以如果x与y中分别取一个数a和b求异或值c,如果c在y中,那a^c=b;如果c在x中,那b ^ c=a;
也就是无论如何,答案一定是偶数。
代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
using namespace std;const int maxn = 2000000 + 5;
int a[maxn],b[maxn];int main(){int n,x;while(scanf("%d",&n)!=EOF){map<int,int> mp;//memset(vis,0,sizeof(vis));for(int i = 0; i < n; i ++) scanf("%d",&a[i]);for(int i = 0; i < n; i ++) scanf("%d",&b[i]);printf("Karen\n");}return 0;
}

Codeforces--896A--The Artful Expedient相关推荐

  1. Codeforces 869A. The Artful Expedient

    A. The Artful Expedient Rock- Paper! After Karen have found the deterministic winning (losing?) stra ...

  2. CodeForces 869A The Artful Expedient

    题目链接:http://codeforces.com/contest/869/problem/A 题意:给你长度都为n的序列,xn和yn,问你存在多少组pair(i.j),即x[i]^y[j]是这2n ...

  3. Codeforces Round #439 (Div. 2) A. The Artful Expedient

    A. The Artful Expedient Problem Statement Rock- Paper!     After Karen have found the deterministic ...

  4. CF 869 A. The Artful Expedient【异或】

    A. The Artful Expedient time limit per test1 second memory limit per test256 megabytes inputstandard ...

  5. codeforces The Artful Expedient(数学思维题)

    题目链接: http://codeforces.com/contest/869/problem/A 题目大意: 给你一个n,分别输入两组n个数字,如果这两组数字两两异或的结果与两组数字中的某一个数字相 ...

  6. Codeforces 869 A.The Artful Expedient(博弈论)

    题解 emmmm 看不懂...英语不行,看大意应该是博弈论 , 我就猜谁在什么情况下会赢,结果是胜者只有一个---Karen #include <bits/stdc++.h> using ...

  7. 【Codeforces Round #439 (Div. 2) A】The Artful Expedient

    [链接] 链接 [题意] [题解] 暴力 [错的次数] 在这里输入错的次数 [反思] 在这里输入反思 [代码] #include <bits/stdc++.h> using namespa ...

  8. CF869A The Artful Expedient 结论题+数论

    传送门 题目描述 Tommy和Karen在玩一个游戏. 他们各自准备了一个长度为n的数组,Tommy的数组称作a,Karen的数组称作b. 保证这2n个数互不相同,设这2n个数构成的集合为S. 现在他 ...

  9. Codeforces869A The Artful Expedient

    标签:模拟 Rock... Paper! After Karen have found the deterministicwinning (losing?) strategy for rock-pap ...

最新文章

  1. Redis 日志篇:无畏宕机实现高可用的杀手锏
  2. 150名打工人被AI判定效率低遭开除,“属实是人工智能,能治工人“
  3. 为什么一个星期是7天
  4. python 测试 多线程 _thread和threading模块 线程同步,线程优先级队列
  5. 如何和女生聊天不进入友谊区
  6. 静态函数一个有用的设计模式
  7. mac上php环境_在Mac系统下配置PHP运行环境
  8. SQL Server--用户自定义函数
  9. php post验证输入,$.post()登录验证功能
  10. java地址映射关系,Spring MVC——基础(简介,使用,地址映射)
  11. 表字段顺序有何影响_「品味保定」炸烹虾段乾隆赞 百年保定柔雅香
  12. java 通过sftp服务器上传下载删除文件
  13. 一、数据库应用系统分析及规划
  14. ams1117 lm317 对比_最受电子工程师欢迎的10款经典稳压电源器件,电路当中经常用到...
  15. WordPress优化攻略:全面提升WP网站速度仅需3个加速方法和1个插件
  16. ctbs 应用服务器,CTBS服务器配置方案-高级版
  17. shopex mysql 数据库服务器_shopex数据库优化实例
  18. MFC AFX_EXT_CLASS
  19. Arduino ESP8266/ESP32读取和改写MAC
  20. 安卓开发用什么语言好!这是一份用心整理的Android面试总结,已拿offer入职

热门文章

  1. 自动摘要生成(一):最大边界相关算法(MMR)
  2. 万兴剪刀手去水印教程_万兴神剪手怎么去水印教程,赶快收藏吧
  3. 由于使用计算机编制会计报表,《计算机会计学》1
  4. 计算机开机自启文件夹,开机启动文件夹在哪
  5. springboot入门
  6. mysql 日期查询 今天、明天、本周、七天内、本月、后一个月
  7. python专业版和普通版_Pycharm专业版 社区版 教育版区别
  8. Error: [$injector:unpr]错误解释
  9. android图片显示组件,Android可循环显示图像的Android Gallery组件用法实例
  10. Teach repeat replan 安装中遇到的问题记录