Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:2079 请管理员添加三组数据@rootIn Reply To:Re:2079 请管理员添加三组数据@root Posted by:szwl at 2015-01-02 23:21:21 double rotating_calipers(const point *ps, int n) { double res = 0; int i, j, k; j = 1; k = 2; for(i=0; i<n; i++) { while((xmult(ps[j], ps[k], ps[i]) < xmult(ps[j], ps[(k+1)%n], ps[i])) || (xmult(ps[j], ps[k], ps[i]) < xmult(ps[(j+1)%n], ps[k], ps[i])) ) { while(xmult(ps[j], ps[k], ps[i]) < xmult(ps[j], ps[(k+1)%n], ps[i])) k = (k+1) % n; while(xmult(ps[j], ps[k], ps[i]) < xmult(ps[(j+1)%n], ps[k], ps[i])) j = (j+1) % n; } res = max(res, xmult(ps[j], ps[k], ps[i])/2.0); } return res; } 这么写能过你的数据..但是感觉复杂度其实不高?? 想不到证明的办法..求解答 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator