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 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…
http://poj.org/problem?id=1700 题目大意: 有n个人要过坐船过河,每一个人划船有个时间a[i],每次最多两个人坐一条船过河.且过河时间为两个人中速度慢的,求n个人过河的最短时间. 思路: 贪心. 对于每次过河的,有两种情况: //最快和最慢过去,然后最快回来.在和次慢过去.最快回来 int action1=a[i-1] + a[0] + a[i-2] +a[0]; //最快和次慢过去,然后最快回来,在次慢和最慢过去,次慢回来 int action2=a[1] +a[…
Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13982   Accepted: 5349 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 b…
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…
                                                                                                                           Crossing River Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10311   Accepted: 3889 Description A group of N p…
题目链接: http://poj.org/problem?id=1700 1. 当1个人时: 直接过河 t[0]. 2. 当2个人时: 时间为较慢的那个 t[1]. 3. 当3个人时: 时间为 t[0]+t[1]+t[2]. 4. 当4个以上的人时, 将t[0] 和 t[1]当作搬运工. 两种方案: - 最快和次快的过去, 最快的回来, 最慢和次慢的过去, 次快的回来, 这样就将最慢和次慢的送过去了. 时间: t[0]+2*t[1]+t[i] - 最快的依次送最慢和次慢的过去再回来, 时间: 2…
过河问题 时间限制:1000 ms  |  内存限制:65535 KB 难度:5   描述 在漆黑的夜里,N位旅行者来到了一座狭窄而且没有护栏的桥边.如果不借助手电筒的话,大家是无论如何也不敢过桥去的.不幸的是,N个人一共只带了一只手电筒,而桥窄得只够让两个人同时过.如果各自单独过桥的话,N人所需要的时间已知:而如果两人同时过桥,所需要的时间就是走得比较慢的那个人单独行动时所需的时间.问题是,如何设计一个方案,让这N人尽快过桥.   输入 第一行是一个整数T(1<=T<=20)表示测试数据的组…
主要思路:先排序.有两种可能是最小的情况,一种是让最小的去带着最大的过去,然后最小的再回来,还有一种就是先最小的和第二小的一块过去, 然后最小的回来,让最大的和第二大的过去,接着第二小的回来,第二小和最小的接着在过去,最小的接着回来,主要就是这两种,用的时候判断一下,接着的问题就是n是奇数还是偶数的问题 排完序之后的a[0]最小, a[n-1]最大,第一种的时间为a[0] + a[n -1] + a[0] + a[n - 2];其中a[0]是最短的时间,a[n-1]是最大的时间,下面一样, 第二…
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…