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

谁帮我找下错,为什么老是未知信号6?

Posted by 200628590 at 2007-04-29 15:31:35
#include"stdio.h"
#include"math.h"
main()
{ int i,j,k,n,p,a[16],b[16];
  float max,y,h,w,s;
  char x[4],ch[16],c,d;
 o: scanf ("%d",&n);
  if (n!=0)
     { for (i=0;i<n;i++)
	   {scanf ("%c");
	    scanf ("%c%d%d",&ch[i],&a[i],&b[i]);
	   }
      max=0.5*((b[2]-b[0])*(a[1]-a[0])-(b[1]-b[0])*(a[2]-a[0]));
     for (i=0;i<n-2;i++)
	 for (j=i+1;j<n-1;j++)
	     for (k=j+1;k<n;k++)
		 { w=fabs(0.5*((b[k]-b[i])*(a[j]-a[i])-(b[j]-b[i])*(a[k]-a[i])));
		   if (max<w)
		     {y=0;
		      for (p=0;p<n;p++)
			  {if (p==i||p==j||p==k) ;
			  else
			   { s=fabs(0.5*((b[p]-b[i])*(a[j]-a[i])-(b[j]-b[i])*(a[p]-a[i])));
			     s=s+fabs(0.5*((b[p]-b[j])*(a[k]-a[j]) - (b[k] - b[j])*(a[p]-a[j])));
			     s=s+fabs(0.5*((b[p] - b[k])*(a[i] - a[k]) - (b[i] - b[k])*(a[p]-a[k])));
			  }
			   if (s==w)
			      y++;
			   }
		 if (y==0)
		    {max=w;
		     x[0]=ch[i];
		     x[1]=ch[j];
		     x[2]=ch[k];
		    }
		 }
	 }
    c=x[0];
    for (i=0;i<3;i++)
	for (j=i;j<3;j++)
	    if (c-x[j]>0)
	       { d=x[j];
		 x[j]=c;
		 c=d;
	       }
     x[0]=c;
    printf ("%c%c%c\n",x[0],x[1],x[2]);
     goto o;
 }
}

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