Crossing River
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 10871 | Accepted: 4097 |
Description
A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the boat back and forth so that all people may cross. Each p

博客内容讲述了如何使用贪心策略解决n个人过河的问题,其中只有一条船且最多载两个人。通过分析不同人数情况,提出分类讨论的方法,特别是当人数大于等于4时,通过比较最快和最慢的人组合与其他组合的时间,来确定最短过河时间。
最低0.47元/天 解锁文章
2770





