• [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;
    }
    
  • 相关阅读:
    Get machine IP and location via open api private static string GetOwnPublicIP() {
    大数据挑战与NoSQL数据库技术
    Objectc 学习之路一(Hello world)
    SharePoint designer 2013 中新的workflow action(操作)
    进程、线程、协程
    网站响应时间过长的原因及解决方法
    Web前端性能优化——如何提高页面加载速度
    使用phpMyAdmin批量修改Mysql数据表前缀的方法
    网站加载速度优化的14个技巧
    从if else 到设计模式的转变 规格严格
  • 原文地址:https://www.cnblogs.com/ljzalc1022/p/8757061.html
Copyright © 2020-2023  润新知