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

## 求大牛帮看看那错啦，WA啊！！！！！！！！！！！！！！

Posted by huronghai at 2012-08-29 11:23:28 on Problem 3304
```#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define eps 1e-8
using namespace std;
struct point{
double x,y;
};
struct Lin{
point p1,p2;
}lin[105];
int n;
double xmult(point p1,point p2,point p0){
return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
bool check(point pt1,point pt2)
{
if(fabs(pt1.x-pt2.x)<eps&&fabs(pt1.y-pt2.y)<eps)return false;
for(int i=1;i<=n;i++){
if(((xmult(lin[i].p1,pt1,pt2))*(xmult(lin[i].p2,pt1,pt2)))>eps)
return false;
}
return true;
}
bool slove()
{
if(n<=2)return true;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++){
if(check(lin[i].p1,lin[j].p1))return true;
if(check(lin[i].p1,lin[j].p2))return true;
if(check(lin[i].p2,lin[j].p1))return true;
if(check(lin[i].p2,lin[j].p1))return true;
}
return false;
}
int main()
{
//freopen("in.txt","r",stdin);
int t;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%lf %lf %lf %lf",&lin[i].p1.x,&lin[i].p1.y,&lin[i].p2.x,&lin[i].p2.y);
if(slove())printf("Yes!\n");
else       printf("No!\n");
}
return 0;
}
```

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

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