HDOJ_1004_Let the Balloon Rise
Font Size: ← →
Problem Description
This year, they decide to leave this lovely job to you.
Input
A test case with N = 0 terminates the input and this test case is not to be processed.
Output
Sample Input
5 green red blue red red 3 pink orange pink 0
Sample Output
red pink AC代码:
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define Max 1005 using namespace std;char a[Max][20]; int b[Max];int main(void) {//freopen("in.txt","r",stdin);int n;while(scanf("%d",&n)!=EOF&&n){getchar();memset(b,0,sizeof(b));for(int i=1;i<=n;i++)gets(a[i]);for(int i=1;i<=n;i++){for(int j=i+1;j<=n;j++){if(strcmp(a[i],a[j])==0){b[i]++;}}}int max=0,count=1;for(int i=1;i<=n;i++){if(b[i]>max){max=b[i];count=i;}}printf("%s\n",a[count]);}//fclose(stdin);return 0; }
转载于:https://www.cnblogs.com/phaLQ/p/10030048.html
HDOJ_1004_Let the Balloon Rise相关推荐
- HDU.1004 Let the Balloon Rise
原题 HDU.1004 Let the Balloon Rise 分类 杂题 题意 找出一组序列中出现次数最多的字符串. 输入/输出 要求与格式 样例数的确定 最后一个样例输入字符串个数为0代表样例输 ...
- [HDU1004] Let the balloon rise - 让气球升起来
[HDU1004] Let the balloon rise - 让气球升起来 Description Contest time again! How excited it is to see bal ...
- hdu-1004 Let the Balloon Rise
题目来源:hdu-1004 Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- HDOJ 1004 Let the Balloon Rise
2019独角兽企业重金招聘Python工程师标准>>> 開源中國寫的第一篇日誌 加油 水呀水 ,不過水壓不小,暈死,一晚上就死在了這裡, 回想一下這題真的真的不難 一開始是思路問題, ...
- HDU 1004 Let the Balloon Rise (map)
题目链接 Problem Description Contest time again! How excited it is to see balloons floating around. But ...
- 算法设计与分析之ZOJ2104- Let the Balloon Rise
问题描述 输入 输入有多组测试例. 对每个测试例,第一个数字是N(0<N<1000),表示气球的数量.接下来N行,每行是一个气球的颜色,由小写字母构成的字符串表示,长度不超过15个 ...
- hdu1004——Let the Balloon Rise
原题: Problem Description Contest time again! How excited it is to see balloons floating around. But t ...
- HDU - Let the Balloon Rise(STL)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Time Limit: 2000/1000 MS (Java/Others) Memory Li ...
- HDU 1004 Let the Balloon Rise
字典树(Trie) 题意是说找出最多的颜色.也就是找出出现次数最多的单词. 插入,然后遍历一遍把最多的输出就能够. #include<cstdio> #include<cstring ...
最新文章
- 【HAOI2010】订货
- Get SQL String From Query Object In Entity Framework
- go waitgroup.done()异常处理_Go 异常处理
- 在洛谷开了一个邀请赛
- Python3实现翻转二叉树问题
- cf 1059e 思维 贪心 树
- iBiology |专业的生信科普网站
- Unity中使用多构造函数(转)
- Leetcode 129. 根到叶子结点数字之和
- EXCEL 选中单元格并拖动等操作。
- 2017-2018-1 20155317《信息安全系统设计基础》 实验五 通讯协议设计
- 我奋斗了18年,不是为了和你一起喝咖啡
- XFire野猪书-XFire开发指南第二版
- Android Layout inflate过程分析(1)
- 运用深度学习进行文本生成
- 第十章 搭建nRF52开发环境(SES)
- 交换机putty怎么调试_【技术】如何登陆交换机进行命令配置?常用的交换机组网模拟器有哪些?...
- C语言之——自定义数据类型
- 免费资源丨如何快速发表论文?八种实验套路及论文技巧告诉你
- speedoffice文档中如何绘制流程图
热门文章
- 从入门到精通!零基础上手车辆目标跟踪与计数
- CVPR 2021 | 大幅涨点!新型动态激活函数和轻量级网络TFNet
- 综述 | 卷积神经网络:从基础技术到研究前景
- 接收率高达29%的ICLR 2021有哪些论文入榜呢?
- 常见特征检测算法介绍
- 零基础入门深度学习 | 第一章:感知器
- 机器学习(二)逻辑回归
- mysql my includedir_MySQL:读取my.cnf的顺序问题
- tortoise从服务器获取项目_项目中一次网络问题处理的复盘
- android stepview 京东,Android-Android-OpenAPI SDK-帮助文档-京东云