Saruman's Army
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 3446 | Accepted: 1752 |
Description
Saruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the troops. Each palantir has a maximum effective range of R units, and must be carried by some troop in the army (i.e., palantirs are not allowed to “free float” in mid-air). He

该博客讨论了如何通过贪心策略解决Saruman带领军队时,确保每个士兵都在palantir的有效范围内,从而确定最小的palantir需求量。输入包含军队的最大有效范围R和士兵数量n,以及士兵的位置。输出是最小的palantir数量。样例展示了不同情况下的解决方案,强调palantir必须由士兵携带,不能独立浮动。
最低0.47元/天 解锁文章
6万+

被折叠的 条评论
为什么被折叠?



