acm之贪心算法题目9

在8888年,地球被PPF帝国统治。为了应对人口增长,PPF决定攻击火星上的Kscinow。为了解决如何让士兵到达火星的问题,PPF提出让士兵们通过魔法扫帚飞行。每个士兵都有一个级别,级别高的可以教级别低的,但不能反之。每个士兵最多只能有一个老师和一个学生,也可以没有。任务是确定最小数量的扫帚,使得所有士兵都能学会飞行。例如,5个士兵(A B C D E)级别分别为2 4 5 6 4,最少需要2把扫帚。输入包含多个测试用例,输出每个测试用例所需的最小扫帚数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 th

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值