zoukankan      html  css  js  c++  java
  • cf--703--A-- Mishka and Game

    题目链接:http://codeforces.com/problemset/problem/703/A

    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
    Copy
    3
    3 5
    2 1
    4 2
    output
    Copy
    Mishka
    input
    Copy
    2
    6 1
    1 6
    output
    Copy
    Friendship is magic!^^
    input
    Copy
    3
    1 5
    3 3
    2 2
    output
    Copy
    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.

    简单模拟一下,每次输入谁的分高谁赢,最后比较总的结果

    AC代码如下:

     1 #include <iostream>
     2 using namespace std;
     3 int main()
     4 {
     5     int n,a,b;
     6     cin>>n;
     7     int ans1 = 0, ans2 = 0;
     8     while(n--)
     9     {
    10         cin>>a>>b;
    11         if(a > b)
    12             ans1++;
    13         else if(a < b)
    14             ans2++;
    15     }
    16     if(ans1 > ans2)
    17         cout<<"Mishka"<<endl;
    18     else if(ans1 < ans2)
    19         cout<<"Chris"<<endl;
    20     else
    21         cout<<"Friendship is magic!^^"<<endl;
    22     return 0;
    23 }
    View Code
    永远年轻 永远热泪盈眶!
  • 相关阅读:
    基于微信红包插件的原理实现android任何APP自动发送评论(已开源)
    人家为撩妹就鼓捣个网页,我做了个约炮APP(已开源)
    android加固签名工具(源码下载)
    如何优雅的写一篇安利文-以Sugar ORM为例
    写给独立开发兄弟共勉-寂寞是19首诗和2首悲歌
    我开源了一个ios应用,你们拿去随便玩
    android用欢迎界面加载运行环境
    用c#操作Mongodb(附demo)
    sql:除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询
    怎样阻止Linux服务器执行rm -rf /*命令
  • 原文地址:https://www.cnblogs.com/Edviv/p/11330222.html
Copyright © 2011-2022 走看看