Flying to the Mars

acm之贪心算法题目9 Problem DescriptionIn the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow who ruling 阅读详情

Flying to the Mars

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9123    Accepted Submission(s): 2969


Problem Description

In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow who ruling the Mars . Here the problem comes! How can the soldiers reach the Mars ? PPF convokes his soldiers and asks for their suggestions . “Rush … ” one soldier answers. “Shut up ! Do I have to remind you that there isn’t any road to the Mars from here!” PPF replies. “Fly !” another answers. PPF smiles :“Clever guy ! Although we haven’t got wings , I can buy some magic broomsticks from HARRY POTTER to help you .” Now , it’s time to learn to fly on a broomstick ! we assume that one soldier has one level number indicating his degree. The soldier who has a higher level could teach the lower , that is to say the former’s level > the latter’s . But the lower can’t teach the higher. One soldier can have only one teacher at most , certainly , having no teacher is also legal. Similarly one soldier can have only one student at most while having no student is also possible. Teacher can teach his student on the same broomstick .Certainly , all the soldier must have practiced on the broomstick before they fly to the Mars! Magic broomstick is expensive !So , can you help PPF to calculate the minimum number of the broomstick needed .
For example : 
There are 5 soldiers (A B C D E)with level numbers : 2 4 5 6 4;
One method :
C could teach B; B could teach A; So , A B C are eligible to study on the same broomstick.
D could teach E;So D E are eligible to study on the same broomstick;
Using this method , we need 2 broomsticks.
Another method:
D could teach A; So A D are eligible to study on the same broomstick.
C could teach B; So B C are eligible to study on the same broomstick.
E with no teacher or student are eligible to study on one broomstick.
Using the method ,we need 3 broomsticks.
……

After checking up all possible method, we found that 2 is the minimum number of broomsticks needed. 
 

Input
Input file contains multiple test cases. 
In a test case,the first line contains a single positive number N indicating the number of soldiers.(0<=N<=3000)
Next N lines :There is only one nonnegative integer on each line , indicating the level number for each soldier.( less than 30 digits);
 

Output
For each case, output the minimum number of broomsticks on a single line.
 

Sample Input
  
4 10 20 30 04 5 2 3 4 3 4
 

Sample Output
  
1 2
 

Author
PPF@JLU
 

Recommend
lcy   |   We have carefully selected several similar problems for you:   1075  1298  1247  1789  1496 




#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
using namespace std;
int main()
{

    __int64 i;;
    //__int64 i;
    int n,max;
    map<__int64,__int64>mp;
    while(scanf("%d",&n)!=EOF)
    {

        mp.clear();
        while(n--)
        {
            scanf("%I64d",&i);
            mp[i]++;
        }
        max=0;
        map<__int64,__int64>::iterator it;
        for(it=mp.begin();it!=mp.end();it++)
        {
            if(max<it->second)
            max=it->second;
        }
        printf("%I64d\n",max);
    }
    return 0;
}


 
『杭电1800』Flying to the Mars Problem Description In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow who ruling the Mars . Here the problem comes! How can the s 阅读详情

相关推荐

银河麒麟V10-ARM架构-postgresql安装与部署指南

本文详细介绍应用源码进行pgsql的安装步骤,本文以postgresql-12.0为例。提示:以下是本篇文章正文内容,下面案例可供参考银河麒麟系统安装程序比较繁琐,潜在问题比较多,个人建议均通过源码自定义编译安装。国产系统还需努力啊!

idols_man的博客 1万+

Flying to the Mars(hdu 1800)(trie tree)

Flying to the Mars(hdu 1800) 8888年,地球被PPF帝国统治着。由于人口的增长,PPF需要寻找更多土地让新出生的人生存。最终,PPF决定去攻打统治火星的Kscinow帝国。现在问题出现了。士兵怎么能到达火星呢?PPF召集他的将士们来征求他们的建议。由于火星上没有路,他们决定飞过去。 现在他们开始学习骑扫帚飞行的技术。我们假设每个士兵有一个数字代表他的级别,级别高的

The_star_is_at的博客 446

VCS HVP与验证计划planner:数字IC验证环境搭建与收敛实践

在数字IC验证中,VCS 是广泛使用的编译型仿真器,HVP 通常指面向硬件验证平台的高性能编译选项集,用于开启 SystemVerilog 类、随机约束和 NTB 等能力;planner 则指验证计划管理,核心是把功能点与测试用例、覆盖点建立映射。理解 VCS 先编译后仿真的原理,有助于优化增量编译、调试访问和覆盖率采集,提升回归收敛效率。规划驱动让激励不再散落,设计改版时能快速定位受影响用例,交接和覆盖率收敛更有依据。无论是 UVM 环境搭建、编译参数选择,还是验证计划表维护,都需要把工具选项与规划方法结

weixin_42543046的博客 338

hdu++1800++STL

这道题刚开始一直和拦截装置混淆了,,,后来才明白两道题的差别。这道题转化之后就是求出现最多的次数,用map可以轻松解决。。。。题目: Flying to the Mars Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 432...

hunxiejun 216

开源ISP实战(1)——基于Zynq7020的Vivado工程移植与调试

本文详细介绍了将开源ISP项目移植到正点原子Zynq7020开发板的实战过程。重点阐述了在Vivado中进行工程创建、IP核导入、Block Design框架搭建、时钟配置与管脚约束修改等关键步骤,并提供了系统联调与常见问题的排查思路,为FPGA图像处理开发者提供了完整的移植与调试指南。

weixin_29191081的博客 200

【CarMaker实战指南】从零构建环形测试场景与车辆连续仿真

本文详细介绍了如何使用CarMaker软件从零构建环形测试场景与实现车辆连续仿真。通过分步指导搭建闭环道路、连接交叉路口、规划车辆轨迹等核心操作,帮助用户掌握CarMaker的基础应用技巧,并提供了常见问题排查与进阶优化建议,适用于车辆耐久性测试和自动驾驶算法验证等场景。

weixin_29274969的博客 234

hdu 1800 Flying to the Mars

Flying to the Mars Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22993 Accepted Submission(s): 7364 Problem Description In the year ...

雷银行的博客 380

使用基于python的neurora进行表征相似性分析(RSA)

发现了一款用于表征分析的Python API,还是挺方便的,这里简单介绍一下进行表征相似性分析的使用方法。

zjh12312311的博客 2766

hdu 1800 Flying to the Mars(字典树)

题目链接:hdu 1800 Flying to the Mars 题目大意:N个士兵,每个士兵有一个学习的能力,学习能力强的可以教学习能力弱的,现在N个士兵需要学习使用飞 行扫帚,每一个士兵在教下一个士兵的时候,会把自己练习的扫帚给他,问说N个士兵最少需要多少个扫帚。 解题思路:问题转换成求众数,因为士兵的等级是一个字符串,所以用字典树来统计,需要去除前导0。 #include

不慌不忙、不急不躁 1055

SPD-Conv+YOLOv8:空间深度转换卷积赋能小目标检测,从原理到实战的科研级优化指南

从理解SPD-Conv“空间到深度+逐步卷积”的核心设计,到亲手将其嵌入YOLOv8并验证在小目标场景的表现,再到基于此探索属于自己的科研与工程方向——这个过程能让你深刻理解“小目标特征保留”在检测任务中的核心价值。现在就开始行动,相信你会在小目标检测的“细节捕捉”之路上,走出一条属于自己的技术路径。实验通常会证明:嵌入SPD-Conv后,YOLOv8在小目标AP上提升5-8个百分点,mAP50-95提升3-5个百分点,而推理速度仅下降5%以内,充分体现了其“保细节+提精度”的优势。

m0_64661770的博客 163

零基础做完YOLOv8船只检测系统:HRSC2016数据集 + 完整UI,稳过答辩

亲爱的同学,通过这篇教程,你已经掌握了“基于YOLOv8的HRSC2016微小船只检测系统”从数据集处理、模型训练到Tkinter界面开发的全流程。这个课题既贴合“海事智能化”的产业战略,又涵盖了“目标检测、深度学习、界面开发”等多个毕设评分点,非常适合作为计算机或海事工程专业的毕业设计。在实践中,你可能会遇到“海面背景复杂导致船只漏检”“微小船只识别精度不足”“UI与模型推理同步卡顿”等挑战——别担心,这些都是技术成长的必经之路。

FJN110的博客 108

hdu 1800 Flying to the Mars

Flying to the Mars Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16329    Accepted Submission(s): 5254 Problem Description In

数星星的夜晚 720

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

杭电1800-Flying to the Mars

Flying to the Mars Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8319    Accepted Submission(s): 2692 Problem Description In

ecjtu_acm_菜鸟—鱼尾尾 1145

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

SAP B1中文培訓教材_SDK

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

【1800】Flying to the Mars

1800 使用哈希。map好像也可以做但是很容易超时。 #include<bits/stdc++.h> using namespace std; int n; int Hash[3010]; char str[40]; int BHash(char* s) { long long seed=131; long long h=0; while(*s=='0')s++; while(*s) { h=h*seed+(*s++); } r

weixin_49646622的博客 160
上一篇: 逃离迷宫
下一篇: 畅通工程
evi1743
博客等级 码龄14年 45粉丝 144原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值