Ural 1585. Penguins

1585. Penguins

Time limit: 1.0 second
Memory limit: 64 MB
Programmer Denis has been dreaming of visiting Antarctica since his childhood. However, there are no regular flights to Antarctica from his city. That is why Denis has been studying the continent for the whole summer using a local cinema. Now he knows that there are several kinds of penguins:
  • Emperor Penguins, which are fond of singing;
  • Little Penguins, which enjoy dancing;
  • Macaroni Penguins, which like to go surfing.
Unfortunately, it was not said in the cartoons which kind of penguins was largest in number. Petya decided to clarify this. He watched the cartoons once more and every time he saw a penguin he jotted down its kind in his notebook. Then he gave his notebook to you and asked you to determine the most numerous kind of penguins.

Input

The first line contains the number  n of entries in the notebook ( 1 ≤  n ≤ 1000 ). In each of the next  n lines, there is the name of a kind of penguins, which is one of the following: “Emperor Penguin,” “Little Penguin,” and “Macaroni Penguin.”

Output

Output the most numerous kind of penguins. It is guaranteed that there is only one such kind.

Sample

input output
7
Emperor Penguin
Macaroni Penguin
Little Penguin
Emperor Penguin
Macaroni Penguin
Macaroni Penguin
Little Penguin
Macaroni Penguin
Problem Author: Vladimir Yakovlev
Problem Source: ACM ICPC 2007–2008. NEERC. Eastern Subregion. Yekaterinburg, October 27, 2007
已知共有n只企鹅,并给出n只企鹅的名称(只有'Emperor Penguin' 'Little Penguin' 'Macaroni Penguin'三种)。请输出企鹅名字出现最多的企鹅名字。
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

int main()
{
    int n,i,e=0,m=0,l=0,t;
    string s;
    scanf("%d",&n);
    for(i=1; i<=2*n; i++)
    {
        cin>>s;
        if(s=="Emperor")  e++;
        else if(s=="Little")  l++;
        else if(s=="Macaroni")  m++;
    }
    t=max(e,l);
    t=max(t,m);
    if(t==e) printf("Emperor Penguin");
    else if(t==l) printf("Little Penguin");
    else if(t==m) printf("Macaroni Penguin");
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值