Let the Balloon Rise HDU - 1004

uniapp实现app版本发现新版本后,自动更新 app实现自动更新 阅读详情

Contest time again! How excited it is to see balloons 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. 

Input

Input contains multiple test cases. Each test case 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. 

Output

For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case. 

Sample Input

5
green
red
blue
red
red
3
pink
orange
pink
0

Sample Output

red
pink

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    int n,m,t,x,i,j;
    char s[1020][20];
    int a[1001],b[1001];
    while(~scanf("%d",&n)&&n!=0)
    {
        for(i=0;i<n;i++)
        {
            scanf("%s",s[i]);
            b[i]=strlen(s[i]);
            a[i]=1;
        }
        for(i=0;i<n;i++)
        {
            for(j=0;j<n;j++)
            {
                if(b[i]==b[j])
                {
                    if(strcmp(s[i],s[j])==0)
                        a[i]++;
                }
            }
        }
        m=a[0];
        t=b[0];
        x=0;
        for(i=0;i<n;i++)
        {
            if(a[i]>m)
            {
                m=a[i];
                x=i;
                t=strlen(s[i]);
            }
        }
        for(i=0;i<t;i++)
        {
            if(i==t-1)
                printf("%c\n",s[x][i]);
            else
                printf("%c",s[x][i]);
        }
    }
    return 0;
}

strcmp用法: 

函数名: strcmp
功  能: 字符串比较
用  法: int strcmp(const char *s1, const char *s2);
返回值: 根据ASCII码比较,若参数s1和s2字符串相同则返回0,s1若大于s2则返回大于0的值,s1若小于s2则返回小于0的值
说  明: 它是区分大小写比较的,如果希望不区分大小写进行字符串比较,可以使用stricmp函数
程序例:

#include <string.h>
#include <stdio.h>

int main(void)
 {
    char *a = "aBcDeF";
    char *b = "AbCdEf";
    char *c = "aacdef";
    char *d = "aBcDeF";
    printf("strcmp(a, b) : %d\n", strcmp(a, b));  // 输出:1
    printf("strcmp(a, c) : %d\n", strcmp(a, c));  // 输出:-1
    printf("strcmp(a, d) : %d\n", strcmp(a, d));  // 输出:0
    return 0;
 }

 

Windows下用Anaconda安装d2l库避坑指南(附PermissionError解决方案) 本文详细介绍了在Windows系统下使用Anaconda安装d2l库的完整指南,特别针对常见的PermissionError问题提供了多种解决方案。从环境准备到库安装,再到VSCode配置和数据路径处理,帮助读者顺利搭建深度学习环境并运行《动手学深度学习》的代码示例。 阅读详情

相关推荐

长短期记忆网络(Long Short-Term Memory networks, LSTM)

如何简单的理解LSTM——其实没有那么复杂:

weixin_39910711的博客 2万+

HDOJ 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): 138223Accepted Submission(s): 54591 Problem Description Cont...

aiyu520704的博客 377

别再为跨页读写发愁了!STM32F407模拟I2C驱动24C256/512的避坑指南

本文详细解析了STM32F407模拟I2C驱动24C256/512的跨页写入问题,揭示了24C系列存储器'写满一页不会自动翻页'的关键机制,并提供了经过验证的分页写入算法和优化方案。通过GPIO时序优化、地址计算和错误处理等技巧,帮助开发者解决数据错乱、覆盖等常见问题,实现稳定可靠的EEPROM读写操作。

weixin_42631411的博客 376

让气球飞起来

这是一道我们大一新生C语言课上我认为比较困难的题我想了很久才有一个思路,我认为很有必要记录下这道题。 Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite time is guessing the most popular problem. When the contest is over, they w

lrr55的博客 1709

【操作系统】实验楼操作系统实验三——系统调用

操作系统实验3——系统调用 环境配置 ​ 首先同样是配置环境 cd /home/shiyanlou/oslab tar -zxvf hit-oslab-linux-20110823.tar.gz -C /home/shiyanlou 实验步骤 添加函数声明 cd ~/oslab/linux-0.11/include/linux gedit sys.h //添加内容: extern int sys_whoami(); extern int sys_iam(); fn_ptr_sys_call_table

qq_46612803的博客 6357

RK3568部署YOLOv8的7种方法对比:量化vs非量化的性能实测与优化建议

本文针对RK3568平台,深度对比了YOLOv8模型的七种部署方法,重点分析了量化与非量化策略的性能差异。通过实测数据,详细评估了不同方法在推理速度、CPU占用、内存消耗及模型精度上的表现,并提供了从模型结构调整到系统级优化的具体建议,为边缘AI部署选型提供实用参考。

weixin_29099217的博客 527

C语言解题——Let the Balloon Rise

每天更新一道OJ题目,今日介绍for 和 while 循环的使用方法和示例。Contest time again! How excited it is to see balloons 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

Xa_L 1439

Python 爬虫进阶技巧:定时爬虫任务实现无人值守采集

常规爬虫多依赖手动触发脚本运行,单次采集完成后需人工二次启动,无法满足日常周期性数据监控、行情抓取、资讯同步、业务台账定时归档等常态化采集需求。搭建可自主调度、自动启停、周期循环的定时爬虫任务,脱离人工干预实现无人值守全自动采集,是爬虫从临时脚本走向工程化落地的关键一步。schedule 轻量定时库官方文档APScheduler 高级定时框架官方文档Python time 内置模块官方文档Linux crontab 定时任务官方手册。

2503_91057718的博客 1117

《ACM程序设计》书中题目O(裁判最喜欢猜气球)

Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over

July_xunle的博客 1009

Codex 实战 Skills:自动采集一天之内的 Git 提交,一键排版成精美工作日报并发送邮件

特性手动撰写脚本辅助(仅聚合)AI 增强自动化(本文方案)时间成本高(30-60分钟/天)中(5-10分钟/天)低(<1分钟/天)内容质量依赖个人总结能力原始数据堆砌,缺乏提炼专业、结构化、有业务视角信息完整性易遗漏完整,但难以阅读完整,且经过分类筛选维护成本无低中(需维护 Skill 配置)可扩展性低中高(可轻松添加周报、月报)适用场景所有开发者初级开发者追求效率的高级开发者本文详细介绍了一种基于 Codex Agent Skills 的自动日报生成方案。

yueyeguzhuo的专栏 102

推荐系统(一)概述

在互联网领域,推荐系统(Recommendation Systems)的应用非常广泛。在音视频方面,如抖音、快手、哔哩等;在电商平台方面,如京东、淘宝、拼多多等。推荐有助于帮助用户快速发现潜在感兴趣的内容(音视频、商品、新闻等信息流),从而提升用户体验,同时有助于提升商业效率。从本文开始,笔者将结合自身在信息流推荐领域的经验,通过系列文章对推荐系统展开介绍。

Jin_Kwok的博客 6084

STL的Map例题-气球问题

Contest time again! How excited it is to see balloons 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 cou...

A's World 2154

addBumpConnectTargetConstraint 命令详解

本文介绍了Cadence Innovus中用于倒装芯片设计的addBumpConnectTargetConstraint命令的核心功能和使用方法。该命令主要用于为凸点(Bump)添加连接目标约束,通过绑定实例、引脚/网络和端口号等属性,实现凸点与电源/信号网络的精准映射。文章详细解析了命令语法结构、参数说明及使用场景,包括必选参数(指定凸点方式)、分支选择(实例连接或电源连接类型)以及互斥参数(引脚名与网络名)等重要注意事项,并提供了典型应用示例。该命令特别适用于倒装芯片设计中凸点与PG网络、IO实例的连接

u013620135的博客 394

HDU-1004 Let the Balloon Rise

水题 HDU-1004 Let the Balloon Rise 题目链接:杭电1004 题目大意:找出出现次数最多的颜色 解题思路:将数据储存在结构体里 最后找到次数最多的 记得每进行一次进行初始化 代码块: #include<iostream> #include<cstring> using namespace std; struct col { char co...

鱼头的水题之路 299

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

HDU1004 Let The Balloon Rise

HDU1004 Let The Balloon Rise Java解决 问题分析: 这道题解法的关键就在这个for循环里面: for(int j=0;j&lt;n;j++) { if(j==0) a[j]++; else { for(int k=j-1;k&gt;=0;k–) { if(input[j].equals(input[k])) a[j]++; } } } 把所有的颜色一个个比较,第一个...

weixin_43854618的博客 396

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

hdu 1004 (Let the balloon rise) c、c++

hdu 1004(Let the balloon rise) 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, ...

weixin_41568105的博客 798

杭电ACM-HDU1004-Let the Balloon Rise

题目来自杭电ACM: acm.hdu.edu.cn Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 93510    Accepted Submission(s): 35712

Soap_egg_pain的博客 2318

hdu1004——Let the Balloon Rise

原题: Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When th

丙三醇 4073

hdu 1004 Let the Balloon Rise(水)

题目链接:hdu 1004 Let the Balloon Rise #include #include #include #include #include using namespace std; const int maxn = 1005; int N; map G; int main () { while (scanf("%d", &N) == 1 && N)

不慌不忙、不急不躁 755

HDU 1004 Let the Balloon Rise

ACM OJ题解目录 本题网址:https://cn.vjudge.net/problem/HDU-1004 Let the Balloon Rise Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite time ...

龙少的小窝 1187

HDU - 1004 Let the Balloon Rise

//注意,这样写出来的代码,flag数组里面的数量要比实际字符串数量少一,但对此答案无影响,需要的时候加一个一即可 #include&amp;quot;iostream&amp;quot; #include&amp;quot;stdio.h&amp;quot; #include&amp;quot;string.h&amp;quot; using namespace std; int max(int flag[1050],int N) { int i;

LOUTINI的博客 197

Let the Balloon Rise HDU1004

Let the Balloon Rise HDU1004 Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 155766 Accepted Submission(s): 61907 Pr...

九峰的博客 248

HDU 1004 Let the Balloon Rise (STL map)

HDU 1004 Let the Balloon Rise 题解 #include&amp;lt;iostream&amp;gt; #include&amp;lt;algorithm&amp;gt; #include&amp;lt;string&amp;gt; #include&amp;lt;math.h&amp;gt; #include&amp;lt;set&amp;gt; #includ

Face_to_sun 233

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): 98230    Accepted Submission(s): 37599 Problem Description Con

小坏蛋_千千 1133

HDU - 1004 Let the Balloon Rise 【map】

Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over,...

一定要站在自己热爱的生活里闪闪发光 3万+

HDU1004:Let the Balloon Rise

HDU1004:Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 127904Accepted Submission(s): 50515 Problem Description ...

aboc43983的博客 147

HDU.1004 Let the Balloon Rise

原题 HDU.1004 Let the Balloon Rise 分类 杂题 题意 找出一组序列中出现次数最多的字符串。 输入/输出 要求与格式 样例数的确定 最后一个样例输入字符串个数为0代表样例输入结束 每个样例的输入 第一行为字符串个数nnn,后nnn行为具体字符串 输出结果 出现次数最多的单词内容 输出格式 每个案例独占一行 特别说明 保证每个输入都有唯一解...

God-Excious的博客 251
上一篇: Digital Roots HDU - 1013
下一篇: 汇编语言DW DD DB的使用区别
RR-RR
博客等级 码龄10年 23粉丝 66原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值