zoukankan      html  css  js  c++  java
  • 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.

    A题居然这么水!!昨晚cf挤爆好不容易刷进去发现A题就是一道比较大小??!居然还到了七分钟才交TAT。

    水AC代码:

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<cstring>
     4 #include<algorithm>
     5 #include<cmath>
     6 using namespace std;
     7 
     8 int main(){
     9     int n,b,c;
    10     cin>>n;
    11     int x=0,y=0;
    12     while(n--){
    13         cin>>b>>c;
    14         if(b>c)
    15         x++;
    16         if(b<c)
    17         y++;
    18     }
    19     if(x>y){
    20         cout<<"Mishka";
    21     }
    22     if(y>x){
    23         cout<<"Chris";
    24     }
    25     if(x==y){
    26         cout<<"Friendship is magic!^^";
    27     }
    28     return 0;
    29 }

    说实话这种题贴出来就是为了凑篇幅啊 嘛..用来掩盖我好些天偷懒没更博客的事实【雾!

  • 相关阅读:
    oracle 10g正则表达式REGEXP_LIKE用法
    impdp时出现ORA-39125错误的解决方法
    使用rman恢复备份集到不同的主机上
    ORA-01110: data file 1: '/opt/ora10g/oradata/orcla/system01.dbf'错误
    Oracle模拟文件损坏BBED
    RMAN进行基于数据块的恢复
    转:Java中Image的水平翻转、缩放与自由旋转操作
    hue耗流量优化
    解决hue/hiveserver2对于hive date类型显示为NULL的问题
    解决kylin sync table报错:MetaException(message:java.lang.ClassNotFoundException Class org.apache.hive.hcatalog.data.JsonSerDe not found
  • 原文地址:https://www.cnblogs.com/Kiven5197/p/5740309.html
Copyright © 2011-2022 走看看