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!
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.
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.
3
3 5
2 1
4 2
Mishka
2
6 1
1 6
Friendship is magic!^^
3
1 5
3 3
2 2
Chris
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代码如下:
#include <iostream>
using namespace std;
int main()
{
int n,a,b;
cin>>n;
int ans1 = , ans2 = ;
while(n--)
{
cin>>a>>b;
if(a > b)
ans1++;
else if(a < b)
ans2++;
}
if(ans1 > ans2)
cout<<"Mishka"<<endl;
else if(ans1 < ans2)
cout<<"Chris"<<endl;
else
cout<<"Friendship is magic!^^"<<endl;
return ;
}
最新文章
- Mathematica(MMA)闪电入门系列 目录与说明
- ASP.NET Web API 应用教程(一) ——数据流使用
- iOS 状态栏黑色背景白色字体
- DataTable或者DataRow转换对象
- javaSE基础——常见的dos命令即其他
- 【redis】06Redis的高级应用之事务处理、持久化操作、pub_sub、虚拟内存
- NSUserDefaults存储自定义对象
- JavaWeb_Day10_学习笔记1_response(3、4、5、6、7、8、9)发送状态码、响应、重定向、定时刷新、禁用浏览器缓存、响应字节数据、快捷重定向方法、完成防盗链
- 【技巧】DataGridView,ListView重新绑定时保持上次滚动位置
- (转)设置 UILabel 和 UITextField 的 Padding 或 Insets (理解UIEdgeInsets)
- jvm常用参数设置 good
- java web(一):tomcat服务器的安装和简单介绍,与eclipse关联
- Integer.parseInt vs Integer.valueOf
- ASP.NET C# 如何在程序中控制IIS服务或应用程序池重启?
- python+selenium+unittest 实现自动化测试
- win10 图标异常 ,重命名后,图标不显示,名字错乱。
- 转-使用 CefSharp 在 C# App 中嵌入 Chrome 浏览器
- es6从零学习(五):Module的语法
- winform 中设置窗体的默认焦点
- 基于Photon 的 PUN+ 如何自动实现RPC呼叫的.