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:搜索最远点的时候应该这样写才能AC!In Reply To:搜索最远点的时候应该这样写才能AC! Posted by:POJ_Cyx at 2011-01-11 19:31:52 > 注释部分是WA的 > double maxdis=0; > int maxi=0,maxj=0; > /*for (int i=1;i<=poly.n-1;i++) > { > for (int j=i+1;j<=poly.n;j++) > { > double tdis=dis(poly.p[i],poly.p[j]); > if (tdis>=maxdis) > { > maxdis=tdis; maxi=i; maxj=j; > } > } > }*/ > for (int i=1;i<=poly.n;i++) > { > for (int j=1;j<=poly.n;j++) > { > if (i==j) continue; > if (double_cmp(dis(poly.p[i],poly.p[j])-maxdis)>=0) > { > maxdis=dis(poly.p[i],poly.p[j]); > maxi=i; maxj=j; > } > } > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator