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

为什么有C++就AC,别的就EA

Posted by loves at 2007-11-11 16:44:42 on Problem 1675
#include<stdio.h>
#include<math.h>

double Angle(int x,int y)
{double pi=3.14159265358979323846;
	double angle;
	double r=sqrt(x*x+y*y);
	if (y>=0)
	{
		angle=acos(x/r);
	}
	else
	{
		angle=2*pi-acos(x/r);
	}
	angle=angle/pi*180;
	return angle;

}
void swap(double &a,double &b)
{
	double buf;
	buf=a;
	a=b;
	b=buf;
}

int main()
{int t,r,x1,y1,x2,y2,x3,y3,flag;
 double angle[4];
 scanf("%d",&t);
 while(t--)
 {scanf("%d%d%d%d%d%d%d",&r,&x1,&y1,&x2,&y2,&x3,&y3);
  flag=1;
 // if(x1==0&&y1==0||x2==0&&y2==0||x3==0&&y3==0)flag=0;
  //else{
  angle[1]=Angle(x1,y1);
   angle[2]=Angle(x2,y2);
   angle[3]=Angle(x3,y3);
   
   if (angle[2]<angle[1]) swap(angle[1],angle[2]);
		if (angle[3]<angle[1]) swap(angle[1],angle[3]);
		if (angle[2]>angle[3]) swap(angle[2],angle[3]);
		if (angle[1]>angle[3]) swap(angle[1],angle[3]);

  
  // qsort(angle,3,sizeof(double),fun);
  // printf("%lf %lf %lf\n",angle[1],angle[2],angle[3]);
   if(angle[3]-angle[1]<=120)flag=0;
  if(angle[2]+360-angle[3]<=120)flag=0;
  if(angle[1]+360-angle[2]<=120)flag=0;

  //} 
  if(flag)printf("Yes\n");
	  else printf("No\n");
	  
 }
}

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