Codeforces Round #365 (Div. 2) A

Description

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

33 52 14 2

output

Mishka

input

26 11 6

output

Friendship is magic!^^

input

31 53 32 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 Chris.

题意:两个人抛色子,谁赢的次数多?

解法:模拟

#include <bits/stdc++.h>
using namespace std;
#define inf (1<<31)-1
int a,b;
int n,m;
int sum1,sum2,sum3;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(a>b)
        {
            sum1++;
        }
        else if(a==b)
        {
            sum2++;
        }
        else
        {
            sum3++;
        }
    }
    if(n%2==0)
    {
        if(sum1>sum3)
        {
            cout<<"Mishka"<<endl;
        }
        else if(sum1==sum3)
        {
            cout<<"Friendship is magic!^^"<<endl;
        }
        else
        {
            cout<<"Chris"<<endl;
        }
    }
    else
    {
        if(sum1>sum3)
        {
            cout<<"Mishka"<<endl;
        }
        else if(sum1==sum3)
        {
            cout<<"Friendship is magic!^^"<<endl;
        }
        else
        {
            cout<<"Chris"<<endl;
        }
    }
    return 0;
}

  

时间: 2024-07-31 14:31:21

Codeforces Round #365 (Div. 2) A的相关文章

Codeforces Round #365 (Div. 2) D - Mishka and Interesting sum(离线树状数组)

http://codeforces.com/contest/703/problem/D 题意: 给出一行数,有m次查询,每次查询输出区间内出现次数为偶数次的数字的异或和. 思路: 这儿利用一下异或和的性质,在一个区间中,我们如果把所有数字都异或的话,可以发现最后偶数次的数字异或后都变成了0,只剩下了奇数次的数字异或. 举个例子,{1,2,3,2,3,5} 异或和是1^2^3^2^3^5=1^5 因为最后要计算偶数次数字的异或和,那么最后我们只需要再异或上该区间内所有不同数字即可. 那么我们可以先

Codeforces Round #365 (Div. 2) C

链接:http://codeforces.com/problemset/problem/703/C 分析:  这题其实是个大水题,只要短短的几行就可以搞定的, 首先需要直觉判断一点,就是只要判断最左边的点和最下面的点 以及和他们相邻边的右边的点 第二部我们就需要判断人与这两个边有没有交点,如果人与上面的有交点,那么人肯定就需要在下面的那条边等待  等待的时间是 max(x - y*1.0*v/u) 那么我们所需要做的还有一步就是判断就是需不需要等待 ,当min(x - y*1.0*v/u) >=

Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum (离线树状数组+前缀xor)

题目链接:http://codeforces.com/contest/703/problem/D 给你n个数,m次查询,每次查询问你l到r之间出现偶数次的数字xor和是多少. 我们可以先预处理前缀和Xor[i],表示1~i的xor和.因为num^num=0,所以Xor[r] ^ Xor[l - 1]求的是l~r之间出现奇数次的数字xor和. 那怎么求偶数次的呢,那我们可以先求l到r之间不重复出现数字的xor(比如1 1 2 求的是1 ^ 2),然后再xor以上求出的Xor[r] ^ Xor[l

Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum 树状数组

D. Mishka and Interesting sum 链接: http://codeforces.com/problemset/problem/703/D 题意: 给一个序列 每次询问一个区间 求区间中出现次数为偶数次的数的异或和 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<map> 5 using namespace std; 6 7 str

Codeforces Round #365 (Div. 2)

5/5 这场CF有毒啊!!好在不计rating(/▽╲) 题A Mishka and Game 题意:略 题解:略 题B Mishka and trip 题意:给你一个图,告诉你一开始围成一个环,然后每个点都有自己的权值,然后两个点的路径权值为这两个点的乘积,然后告诉你某些点是中心点,然后问你权值之和. 题解:这题有点意思,第一题太水了,反而觉得不太好. (1)先算出对于那些中心点的所有权值,这样会重复,画图发现重了的地方就是多算了一次这些中心点形成的完全图,所以只要(2)减去这些中心点形成的完

Codeforces Round #365 (Div. 2) B

Description Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautiful, but little-known northern country. Here are some interesting facts about XXX: XXX consists of n 

Codeforces Round #365 (Div. 2) D 树状数组+离线处理

D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her wit

Codeforces Round #365 (Div. 2) D.Mishka and Interesting sum

题目链接:传送门 题目大意:给n个数,m次询问,每次询问区间 l,r 内出现偶数次数的异或和 题目思路:前缀和+离线处理+树状数组 首先可以知道, l,r 内出现奇数次的数的和,就是把 l,r内所有数异或起来就是答案,那么出现偶数次的数就可以 先求出区间 l,r 内有多少不同的数,将这些数异或起来,再异或上区间内出现奇数次的数的异或和就是答案.(出现偶数次的数异或后为0,奇数次的数异或后是本身   然后离线处理询问,对询问按右端点 sort,因为树状数组保存的是数出现的最后位置.离线处理询问后便

Codeforces Round #365 (Div. 2) ABCD

A. Mishka and Game 题解: 水题..比较大小即可 代码: #include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define se second #define fs first #define ll long long #define CLR(x) memset(x,0,sizeof x) #define SZ(x) ((int)(x).size())