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

祝大家中秋快乐

Posted by Essence_me at 2005-09-17 20:23:43 on Problem 1410
In Reply To:老是WA,,,今天晚上班上聚会,,头有点晕~~~~ Posted by:Essence_me at 2005-09-17 20:23:09
> #include <stdio.h>
> #define MAX(x,y) ((x>y)?(x):(y))
> #define MIN(x,y) ((x<y)?(x):(y))
> int main()
> {
> 	int n,i,real;
> 	double px1,px2,py1,py2,x1,y1,x2,y2;
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 	{
> 		float x,y,ex;
> 		scanf("%lf %lf %lf %lf",&px1,&py1,&px2,&py2);
> 		scanf("%lf %lf",&x1,&y1);
> 		scanf("%lf %lf",&x2,&y2);
> 		real=1;
>  	    	if(x2<x1){ex=x1;x1=x2;x2=ex;}
> 		if(y2<y1){ex=y1;y1=y2;y2=ex;}
> 		if(x1<=MAX(px1,px2)&&x1>=MIN(px1,px2)&&(y2-py1)*(px2-px1)>=(x1-px1)*
> 
> (py2-py1)&&(y1-py1)*(px2-px1)<=(x1-px1)*(py2-py1))real=0;
> 		else if(x2<=MAX(px1,px2)&&x2>=MIN(px1,px2)&&(y2-py1)*(px2-px1)>=(x2-
> 
> px1)*(py2-py1)&&(y1-py1)*(px2-px1)<=(x2-px1)*(py2-py1))real=0;
> 		else if(y1<=MAX(py1,py2)&&y1>=MIN(py1,py2)&&(x2-px1)*(py2-py1)>=(y1-
> 
> py1)*(px2-px1)&&(x1-px1)*(py2-py1)<=(y1-py1)*(px2-px1))real=0;
> 		else if(y2<=MAX(py1,py2)&&y2>=MIN(py1,py2)&&(x2-px1)*(py2-py1)>=(y2-
> 
> py1)*(px2-px1)&&(x1-px1)*(py2-py1)<=(y2-py1)*(px2-px1))real=0;
> 		else if
> 
> (px1<=x2&&px1>=x1&&px2<=x2&&px2>=x1&&py1<=y2&&py1>=y1&&py2<=y2&&py2>=y1)real=0;
>         	if(real)printf("F\n");
>         	else printf("T\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