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

## 为什么会wa？？求高手帮忙看看！！谢谢^_^

Posted by P_sam at 2009-09-03 09:33:02 on Problem 3304
```#include"stdio.h"
#define f 0.00000001
struct point{
double x;double y;
}l[2][105];
int judge(struct point a,struct point b,struct point c){
double l=a.x*b.y+b.x*c.y+c.x*a.y-a.y*b.x-b.y*c.x-c.y*a.x;
if(l>0.0)return 1;
else if(l<0.0)return -1;
else return 0;
}//1代表右边，-1代表左边，0代表在直线上
int main(){
int T,find;
scanf("%d",&T);
while(T--){
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%lf %lf %lf %lf",&l[0][i].x,&l[0][i].y,&l[1][i].x,&l[1][i].y);//直线起点存在l【0】，终点l[1]
if(n==1||n==2)find=1;
else {
for(i=1;i<=n;i++){                           //枚举所有的点，先选中一条
for(j=i+1;j<=n;j++){                       //再选一条
for(k=1;k<=n;k++)                      //选中两条直线的端点产生的四条直线L分别判断与其他直线是否相交
if(judge(l[0][i],l[0][j],l[0][k])*judge(l[0][i],l[0][j],l[1][k])==1){find=0; break;}
else find=1;
if(find)break;
for(k=1;k<=n;k++)
if(judge(l[0][i],l[1][j],l[0][k])*judge(l[0][i],l[1][j],l[1][k])==1){find=0;break;}
else find=1;
if(find)break;
for(k=1;k<=n;k++)
if(judge(l[1][i],l[0][j],l[0][k])*judge(l[1][i],l[0][j],l[1][k])==1){find=0;break;}
else find=1;
if(find)break;
for(k=1;k<=n;k++)
if(judge(l[1][i],l[1][j],l[0][k])*judge(l[1][i],l[1][j],l[1][k])==1){find=0;break;}
else find=1;
if(find)break;
}
if(find)break;
}
}
if(find)printf("Yes!\n");
else printf("No!\n");
}
return 0;
}```

Followed by: