702:Crossing River (贪心)】的更多相关文章

Crossing River Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9585 Accepted: 3622 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 arrangem…
[题目描述] N个人过河,一次过去2个回来一个,给出每个人所需时间,问最小过河时间. [题目链接] http://noi.openjudge.cn/ch0406/702/ [算法] 一开始想样例是怎么成立的想了半天,因为一开始以为贪心策略就是最小的人陪每个人过去然后回来,这样子的话样例应该是19.样例:4个人,时间分别为:1 2 5 10.最少时间为17.策略是最小和次小先过去,然后最小回来,最大和次大过去,次小回来,然后最小次小再过去结束.然后按这种策略写wa了,没办法.查了一波题解,发现两种…
Crossing River Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9887   Accepted: 3737 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 arra…
Crossing River 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=26251 题意: N个人希望去过河,但每次只能过两个且要有一个人把船划回来接其他的人: 两个人一起过河所用的时间是两个人中单独过河时间最多的: 求所有人过河所需要的最少的时间. 思路分析: 定义一个装n个人中每个人过河所需要的时间数组a[]:并用sort进行从小到大进行排序. 求将最慢的和次慢的运过去所需的最少时间,下面有两种可能…
Crossing River Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9919   Accepted: 3752 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 arra…
Crossing River Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12260   Accepted: 4641 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 arr…
英文题目: 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 pers…
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. Eac…
题目描述: 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 pers…
题目描述:N个人过河,只有一只船,最多只能有两人划船,每个人划船速度不同,船速为最慢的人的速度.输入T为case个数,每个case输入N为人数,接下来一行输入的是每个人过河的时间,都不相同.要求输出N个人全部过河的时间 算法思想:采用贪心的方法.有两种划船的方法,一种是最快+最慢,最快回,最快+次慢,最快回,循环下去:第二种是最快+次快,次快回,最慢+次慢,最快回,循环下去.那么当剩余人数N>3的时候,比较第一种和第二种的时间,采用耗时短的方法过河.N=1,2,3的时候单独讨论. #includ…