zoukankan      html  css  js  c++  java
  • cf703A Mishka and Game

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

    无聊的模拟

     1 #include<cstdio>
     2 #include<iostream>
     3 #include<cstring>
     4 #include<queue>
     5 #include<deque>
     6 #include<set>
     7 #include<map>
     8 #include<ctime>
     9 #define LL long long
    10 #define inf 0x7ffffff
    11 #define pa pair<int,int>
    12 #define pi 3.1415926535897932384626433832795028841971
    13 using namespace std;
    14 inline LL read()
    15 {
    16     LL x=0,f=1;char ch=getchar();
    17     while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    18     while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    19     return x*f;
    20 }
    21 inline void write(LL a)
    22 {
    23     if (a<0){printf("-");a=-a;}
    24     if (a>=10)write(a/10);
    25     putchar(a%10+'0');
    26 }
    27 inline void writeln(LL a){write(a);printf("
    ");}
    28 int n,a,b;
    29 int main()
    30 {
    31     n=read();
    32     for (int i=1;i<=n;i++)
    33     {
    34         int x=read(),y=read();
    35         if (x>y)a++;
    36         if (x<y)b++;
    37     }
    38     if (a>b)
    39     printf("Mishka
    ");
    40     else if (a==b)printf("Friendship is magic!^^");
    41     else printf("Chris");
    42 }
    cf703A
    ——by zhber,转载请注明来源
  • 相关阅读:
    ASP.NET ZERO 学习 JTable的ChildTable用法
    ASP.NET ZERO Core Application 学习笔记
    uploadify ASP.net 使用笔记
    金额的加减乘除运算
    利用autoit自动关闭指定标题窗口
    Struts2源代码解读之Action调用
    利用btrace工具监控在线运行java程序
    自己实现的简单MVC框架(类似Struts2+Spring)
    简单实用后台任务执行框架(Struts2+Spring+AJAX前端web界面可以获取进度)
    mybatis源代码分析:mybatis延迟加载机制改进
  • 原文地址:https://www.cnblogs.com/zhber/p/5745866.html
Copyright © 2011-2022 走看看