Let the Balloon Rise HDU - 1004

Tesseract-Ocr踩坑下载以及进行检验 1 OCR,即Optical Character Recognition:光学字符识别,是指通过扫描字符,然后通过其形状将其翻译成电子文本的过程。下载完成后进行解压找到这两个,然后复制到之前下载Tesseract-Ocr的tessdata文件下。可能会出现报错说chi下载的问题咱们不用管继续ok让它先下载完毕,后续会有下载chi的步骤。四、检验tesseract使用(将以下图片进行下载我这里将以下图片命名为3.png)我这里选的是2024年的版本如果下载不了;4 在安装的时候(找到下载的exe文件,双击) 阅读详情

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;
 }

 

置顶必读(1) |《YOLOv11实战:从入门到深度优化》专栏导读,带你一文了解本专栏! 🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏,该专栏专注于分享我在YOLOv8目标检测模型中的实战经验,涵盖从入门基础到深度优化的全方位解决方案。无论你是计算机视觉的新手,还是具有多年深度学习经验的专家,本专栏都将为你提供高效、可复现的技术方案,助你掌握YOLOv8的核心技术,提升目标检测性能,突破瓶颈,优化模型,并加速项目开发🚀! 阅读详情

相关推荐

企业华为TaurusDB数据库国产替代要点全记录

国产化数据库全方位对比、从互联网企业的先进经验来看mysql的用法、及sql优化、sql异构修改、及数据同步方面都做了一些讲解

深耕互联网的码农,在AI及国产化浪潮下,希望把自己的能力输出给更多的人 1063

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

2021-03-08 使用SPDK部署NVMe over TCP

NVMe-oF Target入门指南 SPDK NVMe over Fabrics Target是一个用户空间应用程序,通过以太网,Infiniband或光纤通道等结构呈现块设备,SPDK目前支持RDMA和TCP传输。 本文将在已经编译好SPDK的基础上演示如何使用SPDK搭建NVMe over TCP,前提是您已经将一块NVMe硬盘挂载到linux系统中。 如果您想获取有关SPDK更详细的信息,请参考 官方文档。 演示过程的Host主机的ip地址是192.168.0.21,Target主机的ip地址是19

Pancras的博客 2843

让气球飞起来

这是一道我们大一新生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

攻克+86手机号Discord验证墙:从“无效”到“成功”的实战指南

本文提供了一份针对+86手机号在Discord注册时频繁遭遇“手机号无效”问题的实战解决指南。文章系统分析了问题根源,并分步详解了从打造纯净网络环境、尝试多种手机号格式(如+86前加0),到更换iOS等客户端设备的有效方法,旨在帮助用户成功完成Discord手机号验证。

mac99的博客 1110

SAP-ABAP:SAP信贷管理核心:CL_UKM_BUPA_FACTORY类完整解析与实践指南

SAP信贷管理核心类CL_UKM_BUPA_FACTORY解析 CL_UKM_BUPA_FACTORY是SAP信贷管理(UKM)模块的核心类,作为业务伙伴信贷数据的中央控制台,它提供: 统一入口:标准化实例化客户/供应商信贷对象 主要功能: 获取单条/批量业务伙伴数据 安全保存数据变更 封装底层数据访问逻辑 典型应用场景: 信贷主数据批量维护 自动化限额调整 订单信贷实时检查 性能优化建议: 使用批量方法替代循环单条处理 合理设置字段选择 实施缓存策略 该类通过简洁API简化复杂信贷操作,是SAP信贷管理开

baidu_35680696的博客 1208

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

2025年华为杯D题:低空湍流监测及最优航路规划思路与Matlab实现

2025年华为杯D题:低空湍流监测及最优航路规划思路与Matlab实现

前程算法屋的博客 772

《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

STM32F407+OV2640的DCMI+DMA双缓冲JPEG图像采集系统

在嵌入式视觉系统中,数字摄像头接口(DCMI)是MCU连接CMOS图像传感器的关键硬件通道,其与DMA协同实现零CPU干预的高速数据流采集;而JPEG作为一种基于DCT变换与量化压缩的有损图像格式,依赖传感器端硬件编码引擎才能满足实时性要求。理解DCMI三重同步时序(PCLK/HSYNC/VSYNC)与DMA双缓冲机制的流水线协作原理,是突破带宽瓶颈、避免FIFO溢出和帧丢失的技术基础。该架构广泛应用于智能硬件、工业检测与边缘AI前端等需低功耗、高可靠图像捕获的场景,本文以OV2640与STM32F407为

weixin_42103128的博客 156

YOLO26优化:特征融合 | 一种新颖的多尺度特征融合iAFF,适配小目标检测

在YOLO26中如何使用:iAFF加入Neck替代Concat;

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 270

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

Python入门实战:Python生物信息学编程基础

本文旨在为生物学背景的研究人员和对生物信息学感兴趣的程序员提供一个全面的Python生物信息学编程入门指南。我们将从Python基础知识开始,逐步深入到生物信息学特定的工具和技术,最终达到能够独立开发生物信息学分析程序的水平。Python编程基础生物信息学常用数据结构和算法DNA和蛋白质序列分析基因组数据处理生物信息学数据可视化Biopython库的使用实际项目案例背景介绍:概述文章目的、范围和预期读者核心概念与联系:介绍Python和生物信息学的基本概念。

AI架构师小马 1510

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

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

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

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

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

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

杭电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
上一篇: 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、付费专栏及课程。

余额充值