zoukankan      html  css  js  c++  java
  • [CodeForces869A]The Artful Expedient

    Description

    outputstandard output
    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.

    Input

    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

    Output one line — the name of the winner, that is, "Koyomi" or "Karen" (without quotes). Please be aware of the capitalization.

    Sample Input

    3
    1 2 3
    4 5 6

    Sample Output

    Karen

    Sample Input

    5
    2 4 6 8 10
    9 7 5 3 1

    Sample Output

    Karen

    题解

    如果a xor b == c,则a xor c == b, b xor c == a;
    因为要求a,b位于不同序列,所以一对合法数对只有一组对称数对,结果必为偶数,Karen必胜

    #include<cstdio>
    #include<cstring>
    #include<iostream>
    
    using namespace std;
    typedef long long LL;
    
    LL read()
    {
    	LL x=0,f=1;char ch=getchar();
    	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    	return x*f;
    }
    
    int main()
    {
    	int tmp=read();
    	for(int i=1,lim=tmp<<1;i<=lim;i++)tmp=read();
    	cout<<"Karen
    ";
    	return 0;
    }
    
  • 相关阅读:
    计算机网络知识总结-网络安全
    域名恶意指向的解决方法
    域名恶意解析的原因是什么
    域名被人恶意解析的解决方法
    防止域名被恶意解析
    公安部网防G01-网站安全卫士软件/linux防御
    详解web容器
    关于 服务器ip和域名进行一个绑定
    重新温习软件设计之路(2)
    重新温习软件设计之路(1)
  • 原文地址:https://www.cnblogs.com/ljzalc1022/p/8757061.html
Copyright © 2011-2022 走看看