hdu 1004 Let the Balloon Rise
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 74110 Accepted Submission(s):
27711
floating around. But to tell you a secret, the judges' favorite time is guessing
the most popular problem. When the contest is over, they will count the balloons
of each color and find the result.
This year, they decide to leave this
lovely job to you.
starts with a number N (0 < N <= 1000) -- the total number of balloons
distributed. The next N lines contain one color each. The color of a balloon is
a string of up to 15 lower-case letters.
A test case with N = 0
terminates the input and this test case is not to be processed.
popular problem on a single line. It is guaranteed that there is a unique
solution for each test case.
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char color[][];
int num[];
int main()
{
int n, i, j, max;
while(scanf("%d",&n) && n)
{
for (i=; i<n; i++)
scanf("%s",&color[i]);
for(i=; i<; i++)
num[i] = ;
for(i=; i<n; i++)
for(j=; j<i; j++)
if(strcmp(color[i],color[j])==)
num[i]++;
max = ;
j = ;
for(i=; i<n; i++)
if (max<num[i])
{
max = num[i];
j = i;
}
printf("%s\n",color[j]);
}
return ;
}
hdu 1004 Let the Balloon Rise的更多相关文章
- hdu 1004 Let the Balloon Rise(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...
- HDU 1004 Let the Balloon Rise(map的使用)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...
- HDU 1004 Let the Balloon Rise【STL<map>】
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 ...
- hdu 1004 Let the Balloon Rise strcmp、map、trie树
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...
- hdu 1004 Let the Balloon Rise 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 用STL 中的 Map 写的 #include <iostream> #includ ...
- HDU 1004 - Let the Balloon Rise(map 用法样例)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- HDU 1004 Let the Balloon Rise(map应用)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- HDU 1004 Let the Balloon Rise(STL初体验之map)
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
随机推荐
- 【CodeVS2800】 送外卖 最短路+状压DP
首先求出各点之间的最短路,floyed即可,注意是0-n. 然后考虑状压,f[i][j]表示状态为i时访问j点时的最短路和,1表示访问,0表示未访问,然后第j个点所在的位置就是(1<<j) ...
- 为什么angularjs使用ui-router时要使用html5Mode?
为什么我们要在使用angular ui-router时要使用html5Mode=true这个呢? 在angular中,你在访问链接时,可能访问的链接为"#/link". 如果你设置 ...
- CSS3中的变形与动画【转】
最近在学习制作移动端的页面,做了一个微信页面的小demo,其中用到了很多的CSS3新增的内容,其中就有CSS3新增的变形和动画.其实这种CSS3的动画效果用JS也可以实现,不过CSS3能开启硬件加速, ...
- 指针与数组的区别 —— 《C语言深度剖析》读书心得
原书很多已经写的很清楚很精炼了,我也无谓做无意义的搬运,仅把一些基础和一些我自己以前容易搞混的地方写一下. 1. 意义: 指针: 指针也是一种类型,长度为4字节,其存放的内容只能是一个地址(4字节). ...
- 【Alpha】Daily Scrum Meeting第三次
本次随笔调换了展示顺序,把重要的内容放前面. 一.本次Daily Scrum Meeting主要内容 说明要完成alpha版本还需要哪些功能 对这些功能进行分析和实现方式的讨论 强调编码规范和变量命名 ...
- Android 之 ListView的学习
ListView 是一个控件,一个在垂直滚动的列表中显示条目的一个控件,这些条目的内容来自于一个ListAdapter .EditText Button TextView ImageView Chec ...
- python实现之决策树
一.Predict survival on the Titanic 使用泰坦尼克号上的乘客数据,对乘客是否存活进行预测 1.观察数据集合 可能遇到的问题 训练集和测试集特征值得属性并不重合.连续属性和 ...
- JavaScript如何使用this
学习this的使用必须牢记以下两点 1.this是一个只能在函数内部使用的关键字 2.this指向调用函数的那个对象 下面我们来具体讨论一下this的具体使用方法 第一种:通过函数调用的方式----- ...
- CSS3的高级特性
CSS3对响应式设计非常有用:使用CSS3替代图片,在有带宽限制的网页中可有效减少http请求(从而使网页加载更快),并可使网页更灵活.更容易维护. 在开发CSS3时,要记住添加相关的浏览器私有前缀以 ...
- FJNU 1196 汪老司机(DP or 建图+最短路)
1196: 汪老司机 Time Limit: 1000 MS Memory Limit: 257792 KB 64-bit interger IO format: %lld ...