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;
    }
    
  • 相关阅读:
    xampp 安装后无法启动apache 的解决方法
    前端常用规范
    FontAwesome 奥森图标的学习
    获取iframe 内元素的方法
    CSS中的选择器
    使用JavaScript缓存图片
    控制台console对象常用的一些方法
    清除浮动的方法
    浏览器存储:cookie
    HTML的文档类型:<!DOCTYPE >
  • 原文地址:https://www.cnblogs.com/ljzalc1022/p/8757061.html
Copyright © 2011-2022 走看看