Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

why WA啊?

Posted by lysaitl at 2009-05-30 12:43:59 on Problem 3587
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator