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/Others)
Total Submission(s): 87647 Accepted Submission(s): 33130
and find the result.
This year, they decide to leave this lovely job to you.
letters.
A test case with N = 0 terminates the input and this test case is not to be processed.
5
green
red
blue
red
red
3
pink
orange
pink
0
red
pink
想了好久,决定用链表了#include <iostream>
using namespace std;
const int Max=1100;
struct node
{
string s;
int num;
node *next; };
int main()
{
int n;
string str;
while(cin>>n,n)
{
node *head,*p,*q;
head=new node;
head->next=NULL;
for(int i=0; i<n; i++)
{
cin>>str;
q=head;
p=head->next;
while(p)
{
if(p->s==str)
{
p->num++;
break;
}
p=p->next;
q=q->next;
}
if(!p)
{
p=new node;
p->s=str;
p->num=1;
p->next=NULL;
q->next=p;
}
}
p=head->next;
q=head->next;
while(p)
{
if(p->num>q->num)
{
q=p;
}
p=p->next;
}
cout<<q->s<<endl; }
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
Let the Balloon Rise 分类: HDU 2015-06-19 19:11 7人阅读 评论(0) 收藏的更多相关文章
- Hdu 1010 Tempter of the Bone 分类: Translation Mode 2014-08-04 16:11 82人阅读 评论(0) 收藏
Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- makefile基础实例讲解 分类: C/C++ 2015-03-16 10:11 66人阅读 评论(0) 收藏
一.makefile简介 定义:makefile定义了软件开发过程中,项目工程编译链.接接的方法和规则. 产生:由IDE自动生成或者开发者手动书写. 作用:Unix(MAC OS.Solars)和Li ...
- SQL 存储过程 分页 分类: SQL Server 2014-05-16 15:11 449人阅读 评论(0) 收藏
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Au ...
- leetcode N-Queens/N-Queens II, backtracking, hdu 2553 count N-Queens, dfs 分类: leetcode hdoj 2015-07-09 02:07 102人阅读 评论(0) 收藏
for the backtracking part, thanks to the video of stanford cs106b lecture 10 by Julie Zelenski for t ...
- hdu 1053 (huffman coding, greedy algorithm, std::partition, std::priority_queue ) 分类: hdoj 2015-06-18 19:11 22人阅读 评论(0) 收藏
huffman coding, greedy algorithm. std::priority_queue, std::partition, when i use the three commente ...
- Hdu 1507 Uncle Tom's Inherited Land* 分类: Brush Mode 2014-07-30 09:28 112人阅读 评论(0) 收藏
Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- Hdu 1429 胜利大逃亡(续) 分类: Brush Mode 2014-08-07 17:01 92人阅读 评论(0) 收藏
胜利大逃亡(续) Time Limit : 4000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Subm ...
- Hdu 1009 FatMouse' Trade 分类: Translation Mode 2014-08-04 14:07 74人阅读 评论(0) 收藏
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 1532 Drainage Ditches 分类: Brush Mode 2014-07-31 10:38 82人阅读 评论(0) 收藏
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- 【转】Tomcat组件生命周期管理
Tomcat组件生命周期管理 Tomcat中Server,Service,Connector,Engine,Host,Context,它们都实现了org.apache.catalina.Lifecyc ...
- c#:拖动功能
需求:放在图层上一个图片,要实现鼠标可以选中,并实现拖放功能. 需求分析: 1.采用winform方式实现: 2.需要一个PictureBox对象,对该PictureBox添加MouseMove,Mo ...
- CSS位置如何获取的
- Debug 介绍
Debug 设置
- Java数组(初学者必看)
数组无论在哪种编程语言中都算是最重要的数据结构之一,同时不同语言的实现及处理也不尽相同.但凡写过一些程序的人都知道数组的价值及理解数组的重要性,与链表一道,数组成为了基本的数据结构.尽管Java提供了 ...
- 当As3遇见Swift(三)
类 As3 Swift中似乎没有包,包路径的概念.因而显得简洁的多. package { public class ShuaiGe { } } Swift类 class ShuaiGe{ } 类的构造 ...
- Activity之间的数据传递
最常用的Activity之间的数据传递. btnStartAty1.setOnClickListener(new View.OnClickListener() { @Override public v ...
- eclipse 导入jdbc4.jar 包
详细讲解链接 http://wenku.baidu.com/link?url=QUhO2rIL2fYRgOUyd1TQPEgbl0jQr156ioxK5fiwSPm_Tset2okpBEJcO1fmz ...
- PHP和JS实现多按钮提交表单
JS: <html> <head> <script> function submitit1() //交由程序1处理 { document.myForm.action ...
- RMQ求区间最值 nlog(n)
转载于:http://blog.csdn.net/xuzengqiang/article/details/7350465 RMQ算法全称为(Range Minimum/Maximum Query)意思 ...