HDU1004——Let the Balloon Rise
This year, they decide to leave this lovely job to you.
A test case with N = 0 terminates the input and this test case is not to be processed.
green
red
blue
red
red
3
pink
orange
pink
0
pink
分析:map第二弹~
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
using namespace std;
int main()
{
int n;
string color,s;
map<string,int>Balloon;
while(scanf("%d",&n)&&(n!=0))
{
Balloon.clear();
for(int i=0;i<n;i++)
{
cin>>color;
Balloon[color]++;
}
int max=-1;
map<string,int>::iterator p;
for(p=Balloon.begin();p!=Balloon.end();p++)
{
if((*p).second>max)
{
max=(*p).second;
s=(*p).first;
}
}
cout<<s<<endl;
}
return 0;
}
HDU1004——Let the Balloon Rise的更多相关文章
- HDU1004 Let the Balloon Rise(map的简单用法)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- [HDU1004] Let the balloon rise - 让气球升起来
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- hdu1004 Let the Balloon Rise
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- hdu 1004 Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- Let the Balloon Rise 分类: HDU 2015-06-19 19:11 7人阅读 评论(0) 收藏
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- HDU 1004 Let the Balloon Rise map
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- HD1004Let the Balloon Rise
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- Let the Balloon Rise(map)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- akoj-1073- Let the Balloon Rise
Let the Balloon Rise Time Limit:1000MS Memory Limit:65536K Total Submit:92 Accepted:58 Description ...
随机推荐
- 【BZOJ 3294】 3294: [Cqoi2011]放棋子 (DP+组合数学+容斥原理)
3294: [Cqoi2011]放棋子 Description Input 输入第一行为两个整数n, m, c,即行数.列数和棋子的颜色数.第二行包含c个正整数,即每个颜色的棋子数.所有颜色的棋子总数 ...
- 「SCOI2014」方伯伯的商场之旅
「SCOI2014」方伯伯的商场之旅 题目描述 方伯伯有一天去参加一个商场举办的游戏.商场派了一些工作人员排成一行.每个人面前有几堆石子.说来也巧,位置在 \(i\) 的人面前的第 \(j\) 堆的石 ...
- [GCJ2017R2]Fresh Chocolate
题目大意: 有n个团和很多盒糖,每个团中人数不一定相同,每盒糖中都有p颗糖. 现在要给每个团发糖,要求每个人都要发到糖,只有一盒糖发完后才能发下一盒糖. 发糖的顺序可以任意安排,问经过合理安排后,最多 ...
- CXF和Axis2的区别
1.CXF支持 WS-Addressing,WS-Policy, WS-RM, WS-Security和WS-I Basic Profile.Axis2不支持WS-Policy,但是承诺在下面的版本支 ...
- bzoj 3289 莫队 逆序对
莫队维护逆序对,区间左右增减要分类讨论. 记得离散化. /************************************************************** Problem: ...
- 数组、Set对象的互相转换
一.数组与Set对象之间的转换可以实现数组的去重(数组可重复,Set不可重复) 1. 把数组对象转换为Set对象 var arr = [1,2,3,4,5,6,7,6,6,7]; console.lo ...
- IOS发送Email的两种方法
IOS系统框架提供的两种发送Email的方法:openURL 和 MFMailComposeViewController.借助这两个方法,我们可以轻松的在应用里加入如用户反馈这类需要发送邮件的功能. ...
- 一个简单RPC框架是怎样炼成的(V)——引入传输层
开局篇我们说了,RPC框架的四个核心内容 RPC数据的传输. RPC消息 协议 RPC服务注冊 RPC消息处理 接下来处理传输数据.实际应用场景一般都是基于socket.socket代码比較多, ...
- switch语句的基本使用
switch是一个多分支的选择语句. 1.基本格式: switch(整型表达式){ case 整型字面量: ...... default : } 解释: 1)整型字面量可 ...
- gdb 调试的信息输出到文件
# (gdb) set logging file <文件名> # (gdb) set logging on # (gdb) thread apply all bt # (gdb) set ...