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 |
why WA啊?#include<cstdio> #include<iostream> #include<cmath> #include<algorithm> using namespace std; typedef struct point { double x,y; }; point ch[670]; int n; double d[670][670]; double cross(point p0,point p1,point p2) { return (p1.x-p0.x)*(p2.y-p0.y)-(p1.y-p0.y)*(p2.x-p0.x); } double dist(point a,point b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } double maxarea() { int i,j,k; double a,ansr,maxr=0.0; for(i=1;i<n-1;i++) for(j=i+1;j<n;j++) for(k=j+1;k<=n;k++) { a=fabs(cross(ch[i],ch[j],ch[k]))*2;; ansr=(d[i][j]*d[i][k]*d[j][k])/a; if(ansr>maxr) maxr=ansr; } return(maxr); } int main() { int casenum,i,j; scanf("%d",&casenum); while(casenum--) { scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%lf%lf",&ch[i].x,&ch[i].y); } for(i=1;i<=n;i++) for(j=1;j<=n;j++) d[i][j]=dist(ch[i],ch[j]); printf("%.3lf\n",maxarea()); } return(0); } 帮忙看看啊,先 3 k s 了啊 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator