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 |
dfs 能过, 注意下输出-1的特判就行贴一下搜索部分 A表示最大一条边,B表示第二大的边。 面积_cal(A,B,C)是用的海伦公式 void dfs(int A , int B){ if(flag[A][B]||B>A||A>sum/2) return; int C=sum-A-B; flag[A][B]=1; if(A>=B&&B>=C){ double temp=_cal(A,B,C); ans=max(ans,temp); } fr(i,0,n){ if(vis[i]) continue; vis[i]=1; dfs(A+len[i],B); vis[i]=0; } fr(i,0,n){ if(vis[i]) continue; vis[i]=1; dfs(A,B+len[i]); vis[i]=0; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator