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) ...
随机推荐
- 提高神经网络的学习方式Improving the way neural networks learn
When a golf player is first learning to play golf, they usually spend most of their time developing ...
- display:inline-block; 到底是个啥玩意?
display:inline; 内联元素,简单来说就是在同一行显示.display:block; 块级元素,简单来说就是就是有换行,会换到第二行.display:inline-block; 就是在同一 ...
- 使用MJExtension中要注意的地方
MJExtension git地址 https://github.com/CoderMJLee/MJExtension#JSON_Model Model contains model-array[模 ...
- ORACLE 12C PDB 维护基础介绍
来自:http://www.xifenfei.com/2013/05/oracle-12c-pdb-%E7%AE%A1%E7%90%86%E4%BB%8B%E7%BB%8D1.html CDB和PDB ...
- A*啦啦啦
...A*是个啥都不知道.. 大家注意K短路可能不存在!!!! 果然是s==t的问题……加个if(s==t) k++就A了…… 单用Dij,tle到死 原来是单向k短路........开始以为是双向的 ...
- hduoj 4715 Difference Between Primes 2013 ACM/ICPC Asia Regional Online —— Warmup
http://acm.hdu.edu.cn/showproblem.php?pid=4715 Difference Between Primes Time Limit: 2000/1000 MS (J ...
- [原创]java WEB学习笔记47:Servlet 监听器简介, ServletContext(Application 对象), HttpSession (Session 对象), HttpServletRequest (request 对象) 监听器,利用listener理解 三个对象的生命周期
本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...
- 控件ListView
ListView的简单用法,先在布局文件中添加ListView控件: 接下来修改MainActivity中的代码: 由上面的代码可以知道,数据是无法直接传递给ListView的,需要借助适配器来完成. ...
- Oracle数据库归档模式的切换及其相关操作详解
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> ...
- 【ibus】设置ibus输入法(pinyin & sunpinyin)
设置ibus-pinyin 在终端中运行 /usr/lib/ibus-pinyin/ibus-setup-pinyin 命令可以调出ibus的完整设置对话框 设置ibus-sunpinyin 可以执行 ...