7.13 hdoj1004 Let the Balloon Rise
题解:又是一道没什么意思的题目,方法有很多
1、手动去重(我的方法,锻炼写代码能力)
2、数据结构自动去重,map或set了解一下
3、排序,找重复最多的,同2数据结构能自动排序,大雾
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;int i,j,n,len;
char a[1005][1005];
int b[1005];
char str[1005];int main(){while(1){len=0;scanf("%d",&n);if(n==0)break;for(i=1;i<=n;i++){scanf("%s",str);//printf("::%s\n",str);for(j=1;j<=len;j++)if(strcmp(a[j],str)==0){b[j]++;break;}if(j==len+1){strcpy(a[j],str);b[j]=1;++len;}}j=1;for(i=2;i<=len;i++)if(b[i]>b[j])j=i;//printf("%d\n",len);puts(a[j]);}return 0;
}
7.13 hdoj1004 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工程师标准>>> 開源中國寫的第一篇日誌 加油 水呀水 ,不過水壓不小,暈死,一晚上就死在了這裡, 回想一下這題真的真的不難 一開始是思路問題, ...
- hdoj-1004-Let the Balloon Rise(map排序)
map按照value排序 1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 # ...
- HDOJ_1004_Let the Balloon Rise
Font Size: ← → Problem Description Contest time again! How excited it is to see balloons floating ar ...
- 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 ...
最新文章
- 发布任务PHP源码,Thinkphp5新威客任务平台源码
- jsp 中实现点击按钮 实现页面跳转到HTML
- Linux用户管理(六)Linux磁盘管理
- [Java] 蓝桥杯ADV-185 算法提高 五次方数
- C++ 如何画橡皮线
- Spring MVC自动为对象注入枚举数据
- 卡尔曼滤波(Kalman Filter)在目标边框预测中的应用
- python循环的基本思想是重复_python基础-循环
- 2021美赛MCM选题
- 华为给出的测试账号里面的题
- SaaS已死。下一个。
- 4.蒙特卡洛(Monte-Carlo, MC)+时序差分(Temporal Difference, TD)
- zotero文献管理|chartero 插件 绝对是有一款让你离不开的插件,可视化你的文献阅读记录,提取PDF图片方便阅读
- Baltimore System of Classifications of Viruses
- WPS 关闭自动更新和热点新闻推荐
- Linux故障之内核反向路由检测
- linux多磁盘块文件删除过程,如何整理Linux磁盘碎片
- java友盟自定义行为_友盟自定义事件常见问题
- 【SSM框架】【怠惰致错】Invalid bound statement (not found)
- 阿里技术详解图册发布