# 【CodeForces

A The Artful Expedient
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.

Example
Input
3
1 2 3
4 5 6
Output
Karen
Input
5
2 4 6 8 10
9 7 5 3 1
Output
Karen
Note
In the first example, there are 6 pairs satisfying the constraint: (1,?1), (1,?2), (2,?1), (2,?3), (3,?2) and (3,?3). Thus, Karen wins since 6 is an even number.

In the second example, there are 16 such pairs, and Karen wins again.

`#includeusing namespace std;typedef pairpii;#define first fi#define second se#define LL long long#define fread() freopen("in.txt","r",stdin)#define fwrite() freopen("out.txt","w",stdout)#define CLOSE() ios_base::sync_with_stdio(false)const int MAXN = 2e3+10;const int MAXM = 1e7;const int mod = 1e9+7;const int inf = 0x3f3f3f3f;int arr[MAXN];int brr[MAXN];bool vis[MAXM]={0} ;int main(){ CLOSE();// fread();// fwrite(); int n;scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&arr[i]); vis[arr[i]]=1; } for(int i=1;i<=n;i++) { scanf("%d",&brr[i]); vis[brr[i]] =1; } int cnt=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++) { int c=arr[i]^brr[j]; if(vis[c]) cnt++; } } if(cnt&1) puts("Koyomi"); else puts("Karen"); return 0;}`

B The Eternal Immortality

Even if the world is full of counterfeits, I still regard it as wonderful.

Pile up herbs and incense, and arise again from the flames and ashes of its predecessor ? as is known to many, the phoenix does it like this.

The phoenix has a rather long lifespan, and reincarnates itself once every a! years. Here a! denotes the factorial of integer a, that is, a!?=?1?×?2?×?…?×?a. Specifically, 0!?=?1.

Koyomi doesn’t care much about this, but before he gets into another mess with oddities, he is interested in the number of times the phoenix will reincarnate in a timespan of b! years, that is, . Note that when b?≥?a this value is always integer.

As the answer can be quite large, it would be enough for Koyomi just to know the last digit of the answer in decimal representation. And you’re here to provide Koyomi with this knowledge.

Input
The first and only line of input contains two space-separated integers a and b (0?≤?a?≤?b?≤?1018).

Output
Output one line containing a single decimal digit ? the last digit of the value that interests Koyomi.

Example
Input
2 4
Output
2
Input
0 10
Output
0
Input
107 109
Output
2
Note
In the first example, the last digit of is 2;

In the second example, the last digit of is 0;

In the third example, the last digit of is 2.

`#includeusing namespace std;typedef pairpii;#define first fi#define second se#define LL long long#define fread() freopen("in.txt","r",stdin)#define fwrite() freopen("out.txt","w",stdout)#define CLOSE() ios_base::sync_with_stdio(false)const int MAXN = 1e5;const int MAXM = 1e6;const int mod = 1e9+7;const int inf = 0x3f3f3f3f;int main(){ CLOSE();// fread();// fwrite(); LL a,b;cin>>a>>b; if(a==b) { puts("1"); return 0; } LL ans=(a+1)%10; for(LL i = a+2;i<=b;i++) { ans=(ans%10*i%10)%10; if(ans==0) break; } printf("%lld",ans); return 0;}`

C The Intriguing Obsession
? This is not playing but duty as allies of justice, Nii-chan!

? Not allies but justice itself, Onii-chan!

With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters ? Karen and Tsukihi ? is heading for somewhere they’ve never reached ? water-surrounded islands!

There are three clusters of islands, conveniently coloured red, blue and purple. The clusters consist of a, b and c distinct islands respectively.

Bridges have been built between some (possibly all or none) of the islands. A bridge bidirectionally connects two different islands and has length 1. For any two islands of the same colour, either they shouldn’t be reached from each other through bridges, or the shortest distance between them is at least 3, apparently in order to prevent oddities from spreading quickly inside a cluster.

The Fire Sisters are ready for the unknown, but they’d also like to test your courage. And you’re here to figure out the number of different ways to build all bridges under the constraints, and give the answer modulo 998?244?353. Two ways are considered different if a pair of islands exist, such that there’s a bridge between them in one of them, but not in the other.

Input
The first and only line of input contains three space-separated integers a, b and c (1?≤?a,?b,?c?≤?5?000) ? the number of islands in the red, blue and purple clusters, respectively.

Output
Output one line containing an integer ? the number of different ways to build bridges, modulo 998?244?353.

Example
Input
1 1 1
Output
8
Input
1 2 2
Output
63
Input
1 3 5
Output
3264
Input
6 2 9
Output
813023575
Note
In the first example, there are 3 bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is 23?=?8.

In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, respectively.

`#includeusing namespace std;typedef pairpii;#define first fi#define second se#define LL long long#define fread() freopen("in.txt","r",stdin)#define fwrite() freopen("out.txt","w",stdout)#define CLOSE() ios_base::sync_with_stdio(false)const int MAXN = 5000+10;const int MAXM = 1e6;const int mod = 998244353 ;const int inf = 0x3f3f3f3f;LL fac[MAXN]; // 阶乘LL C[MAXN+100][MAXN+100]; // 组合数void init(){ fac=1; for(int i=1;i<=MAXN;i++) fac[i]=fac[i-1]*i%mod; for(int i=0;i<=MAXN;i++) C[i]=1; for(int i=1;i<=MAXN;i++){ for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod; }// for(int i=1;i<=10;i++){// for(int j=1;j<=i;j++)// printf("%d ",C[i][j]);// puts("");// }} LL in;int main(){ CLOSE();// fread();// fwrite(); init(); cin>>in>>in>>in; sort(in+1,in+4); LL ans1=0,ans2=0,ans3=0; for(int i=0;i<=in;i++) ans1=ans1%mod+C[in][i]*C[in][i]%mod*fac[i]%mod; for(int i=0;i<=in;i++) ans2=ans2%mod+C[in][i]*C[in][i]%mod*fac[i]%mod; for(int i=0;i<=in;i++) ans3=ans3%mod+C[in][i]*C[in][i]%mod*fac[i]%mod; printf("%lld",ans1*ans2%mod*ans3%mod); return 0;}`

E
E题的题解链接

## 相关文档

• 迅捷路由器设置网参数是多少
• 个人创业选择什么行业
• 如何做一个贪吃蛇的小游戏
• 唯美浪漫的婚礼主持词精选范文五篇
• 国旗下讲话稿精选7篇
• 2020年春节促销活动方案
• 2017监理工程师《工程控制》精选知识点
• 清明节手机短信祝福语大全
• 网球双打需了解的发球技巧教学
• oppor7一直在开机动画
• 乐观进取句子
• SpringBoot使用LibreOffice转换PDF
• 关于太阳的常识
• 瓶颈期这样做更易度过（下）
• 写丽江风景的文章
• 手机打不了字了怎么办
• linux部署angular项目,.NET Core +Angular 项目 部署到CentOS
• 祝福人生日的诗句
• 伤感个性签名男生带孤独
• 预防糖尿病健康常识
• ctrip-apollo windows环境部署
• QT案例词典 -- 存储内容及遍历
• 度夏要注重四大调养
• 电脑适配器被卸载了怎么办
• 如何与小学老师沟通
• 深入理解函数内部原理（6）??函数的内部方法call、apply、bind
• 动词时态形式的推导过程教程
• 三十天学会绘画pdf_绘画自学零基础入门教程|五天学会绘画pdf百度云下载！
• 父母给在小学的孩子写信

电脑版