Codeforces Round #365 (Div. 2) A. Mishka and Game

来源:互联网 发布:手机上编程 编辑:程序博客网 时间:2024/05/17 01:38

A. Mishka and Game

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they started playing the game.

Rules of the game are very simple: at first number of rounds n is defined. In every round each of the players throws a cubical dice with distinct numbers from 1 to 6 written on its faces. Player, whose value after throwing the dice is greater, wins the round. In case if player dice values are equal, no one of them is a winner.

In average, player, who won most of the rounds, is the winner of the game. In case if two players won the same number of rounds, the result of the game is draw.

Mishka is still very little and can’t count wins and losses, so she asked you to watch their game and determine its result. Please help her!
Input

The first line of the input contains single integer n n (1 ≤ n ≤ 100) — the number of game rounds.

The next n lines contains rounds description. i-th of them contains pair of integers mi and ci (1 ≤ mi,  ci ≤ 6) — values on dice upper face after Mishka’s and Chris’ throws in i-th round respectively.
Output

If Mishka is the winner of the game, print “Mishka” (without quotes) in the only line.

If Chris is the winner of the game, print “Chris” (without quotes) in the only line.

If the result of the game is draw, print “Friendship is magic!^^” (without quotes) in the only line.
Examples
Input

3
3 5
2 1
4 2

Output

Mishka

Input

2
6 1
1 6

Output

Friendship is magic!^^

Input

3
1 5
3 3
2 2

Output

Chris

Note

In the first sample case Mishka loses the first round, but wins second and third rounds and thus she is the winner of the game.

In the second sample case Mishka wins the first round, Chris wins the second round, and the game ends with draw with score 1:1.

In the third sample case Chris wins the first round, but there is no winner of the next two rounds. The winner of the game is Ch

题意:两个人玩游戏,进行n次游戏,每个人说一个数,谁大谁赢,问最后谁赢的次数多

ac代码:

/* ***********************************************Author       : AnICoo1Created Time : 2016-08-06-11.14 SaturdayFile Name    : D:\MyCode\2016-8月\2016-8-6.cppLANGUAGE     : C++Copyright  2016 clh All Rights Reserved************************************************ */#include<stdio.h>#include<math.h>#include<string.h>#include<stack>#include<set>#include<map>#include<queue>#include<vector>#include<iostream>#include<algorithm>#define MAXN 1010000#define LL long long#define ll __int64#define INF 0xfffffff#define mem(x) memset(x,0,sizeof(x))#define PI acos(-1)#define eps 1e-8using namespace std;ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}ll lcm(ll a,ll b){return a/gcd(a,b)*b;}ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}double dpow(double a,ll b){double ans=1.0;while(b){if(b%2)ans=ans*a;a=a*a;b/=2;}return ans;}//headint main(){    int n;cin>>n;int cnta=0,cntb=0;    for(int i=0;i<n;i++)    {        int a,b;cin>>a>>b;        if(a>b) cnta++;        else if(a<b) cntb++;    }    if(cnta>cntb)        cout<<"Mishka"<<endl;    else if(cnta<cntb)        cout<<"Chris"<<endl;    else        cout<<"Friendship is magic!^^"<<endl;    return 0;}
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 孩子发烧在医院查不出病因怎么办 宝宝乳牙长歪了怎么办 两岁宝宝不爱吃水果怎么办 两岁宝宝不吃水果怎么办 一岁的宝宝上火了怎么办 吃水果嘴唇肿了怎么办 二岁宝宝不爱吃饭怎么办 小婴儿便秘但不爱喝水怎么办 宝宝只吃水果不吃饭怎么办 一岁宝宝不喜欢吃水果怎么办 1岁宝宝不吃水果怎么办 一岁半宝宝吃水果拉肚子怎么办 大人发烧了怎么办如何退烧 怀孕后不爱吃水果怎么办 不敢吃水果了怕虫怎么办 宝宝发烧38度不出汗怎么办 1岁宝宝喜欢含饭怎么办 3岁宝宝喜欢含饭怎么办 孩子咳嗽发烧怎么办最有效 孩子咳嗽打哈切流鼻涕发烧怎么办 孩子香蕉吃多了怎么办 80多岁老人发烧怎么办 小孩香蕉吃多了怎么办 7个月宝宝缺钙怎么办 宝宝脖子被汗淹到红了脱皮怎么办? 小儿出汗多咳嗽怎么办吃什么 牛高烧不退怎么办最好 猪体温低不吃食怎么办 小孩发烧咳嗽怎么办吃什么药 大晚上发烧39度怎么办 胃受凉了老打嗝怎么办 大人发低烧怎么办如何退烧 吃了退热药不退热怎么办 猪持续高烧不退怎么办 猪感冒了不吃食怎么办 6岁儿童发烧38度怎么办 5岁儿童发烧38度怎么办 7岁儿童发烧38度怎么办 儿童发烧到38度怎么办 4岁儿童发烧38度怎么办 9岁儿童发烧38度怎么办