Codeforces Round #439 (Div. 2)
来源:互联网 发布:上海交大矩阵理论作业 编辑:程序博客网 时间:2024/06/05 10:16
题意:
从上排和下排各找一对,他们的异或还可以在这两排找到。若对数为偶:karen。
POINT:
可以暴力做,数组要开成2·106 *2,因为有些数异或出来会更大。
也可以直接输出karen,因为a^b=c,c属于两排之间,那么肯定存在a^c=b或者b^c=a。
那么答案肯定为偶数。
注意数中没有0,所以不用多虑。不可能有异或出来相等的情况。
#include <iostream>#include <string.h>#include <stdio.h>#include <math.h>#include<algorithm>using namespace std;#define LL long longconst int maxn = 2222;int x[maxn];int y[maxn];int flag[4000000+44];int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&x[i]); flag[x[i]]=1; } for(int i=1;i<=n;i++){ scanf("%d",&y[i]); flag[y[i]]=1; } int ans=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(flag[x[i]^y[j]]==1){ ans++; } } } if((ans%2)==0){ printf("Karen\n"); }else{ printf("Koyomi\n"); }}
阅读全文
0 0
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2) C
- Codeforces Round #439 (Div. 2) 题解
- Codeforces Round #439 (Div. 2) 总结
- Codeforces Round #439 (Div. 2)A,B
- Codeforces Round #439 (Div. 2)E详解
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- gtest
- WordPress Functions.php文件详解
- java初入多线程7
- EL表达式
- Linux 的文件管理命令
- Codeforces Round #439 (Div. 2)
- Ehcache开启JMX支持
- 2012 NOIP普及组T4 文化之旅
- 工厂模式
- 【末世旅行之Java】HttpClient工具类,包含POST和GET请求,使用了连接池和代理
- Algorithm-week5
- C语言乱码
- 记二次元
- python中用xpath解析网页的基本方法