Mishka and Game

简介: Mishka and Game

文章目录

一、A. Mishka and Game

总结


一、A. Mishka and Game

本题链接:A. Mishka and Game


题目:


A. Mishka and Game


time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard 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 Chris.


本博客给出本题截图:

image.png

image.png

题意:比较大小,看谁赢的多,对应三种不同的输出结果

AC代码

#include <iostream>
using namespace std;
int cntm, cntc;
int main()
{
    int n;
    cin >> n;
    while (n -- )
    {
        int a, b;
        cin >> a >> b;
        if (a > b) cntm ++;
        else if (a < b) cntc ++;
        else 
        {
            cntm ++;
            cntc ++;
        }
    }
    if (cntc > cntm) 
        puts("Chris");
    else if (cntc == cntm)
        puts("Friendship is magic!^^");
    else
        puts("Mishka");
    return 0;
}

总结

水题,不解释

目录
相关文章
|
6月前
|
vr&ar
D - I Wanna Win The Game
D - I Wanna Win The Game
LeetCode 390. Elimination Game
给定一个从1 到 n 排序的整数列表。 首先,从左到右,从第一个数字开始,每隔一个数字进行删除,直到列表的末尾。 第二步,在剩下的数字中,从右到左,从倒数第一个数字开始,每隔一个数字进行删除,直到列表开头。 我们不断重复这两步,从左到右和从右到左交替进行,直到只剩下一个数字。 返回长度为 n 的列表中,最后剩下的数字。
101 0
LeetCode 390. Elimination Game
|
存储 算法
LeetCode 289. Game of Life
如果活细胞周围八个位置的活细胞数少于两个,则该位置活细胞死亡; 如果活细胞周围八个位置有两个或三个活细胞,则该位置活细胞仍然存活; 如果活细胞周围八个位置有超过三个活细胞,则该位置活细胞死亡; 如果死细胞周围正好有三个活细胞,则该位置死细胞复活;
76 0
LeetCode 289. Game of Life
|
算法 索引
LeetCode 45. Jump Game II
给定一个非负整数数组,初始位置在索引为0的位置,数组中的每个元素表示该位置的能够跳转的最大部署。目标是以最小跳跃次数到达最后一个位置(索引)。
80 0
LeetCode 45. Jump Game II
|
算法 索引
LeetCode 55. Jump Game
给定一个非负整数数组,您最初定位在数组的第一个索引处。 数组中的每个元素表示该位置的最大跳转长度。 确定您是否能够到达最后一个索引。
90 0
LeetCode 55. Jump Game
|
人工智能
jump game
最后一步:如果青蛙能跳到最后一块石头n-1,我们考虑他跳的最后一步,这一步是从石头i跳过来,i&lt;n-1 这需要两个条件同时满足: 1.青蛙可以调到石头i; 2.最后一步不超过跳跃的最大距离:n-1-i &lt;= ai
114 0
jump game
HDOJ 2053 Switch Game
HDOJ 2053 Switch Game
79 0
|
人工智能 算法 大数据
LeetCode - 45. Jump Game II
45. Jump Game II  Problem's Link  ---------------------------------------------------------------------------- Mean:  给定一个数组a,玩家的初始位置在idx=0,玩家需要到达的位置是idx=a.
938 0