作者changkh (留学生涯)
看板ck47th320
标题Re: [问题] 又一个演算法的问题
时间Sun Mar 27 10:33:54 2005
※ 引述《mikek (rabbit)》之铭言:
: ※ 引述《changkh (留学生涯)》之铭言:
: : 没错,就是这样子。
: : 所以觉得蛮难想的。
: Sorry, I can't type Chinese right now.
: I hope the solution below is correct. It's just for your information.
: Assume there are n wells.
: The position d(k) of the k-th well has to satisfy all of the following
: conditions:
: (k-1)/k < d(k) < k/k which is the valid interval if there are k wells
: (k-1)/(k+1) < d(k) < k/(k+1) which is the valid interval if k+1 wells
: ...
: (k-1)/n < d(k) < k/n which is the valid interval if there are n wells
: Note that for all wells (i.e. k=1,2,3,...,n), the above inequalities must
: hold.
这样看起来好像是有假设第k个都在k/i的地方,对於i>=k。可是其实是不一定的。
例如原来在2/5区间内的可能之後会变成到4/10区间的井。
: So we only need to check k=1 (n<inf) and k=2 (n<4).
: Therefore, the number of wells is at most 3 (n<4).
目前我试过的井数最多是成功到八个井。之後有些复杂,所以还没试过。所以我想
不只三个井。不过还是谢谢你啦。因为你的式子,我有了新的想法,但是还是不完全。
假设在第k步,加了井在di,而它在(j-1)/k<di<j/k区间。
若此井造成未来某区间已有两个井,设是它和它目前左边那个井造成的,若该
井是dl, 则它在(j-2)/k<dl<(j-1)/k之间。
假设dl和di在m个井时已在同一区间,设是在(p-1)/m到p/m的区间之中。
则可以得到
(j-1)/k<di<p/m
(p-1)/m<dl<(j-1)/k
两式相加、即减得到di+dl, di-dl,可以再解出一个di和dl的范围:
1/2((p-1)/m+(j-1)/k) < di < 1/2(2p/m+(j-1)/k)
1/2((j-1)/k-1/m) < dl < 1/2(p/m+(j-1)/k)
如果在这个范围内,那di和dl会满足 k个井时的条件,但是在m个井时已经在
同一区间内。
但是接下来要怎麽做就不知道了。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 68.43.196.35