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

Re:错哪里了?不明白。。。

Posted by yan3276 at 2007-10-09 21:21:45 on Problem 1269
In Reply To:错哪里了?不明白。。。 Posted by:qiqilrq at 2007-01-26 01:07:13
> #include <stdio.h>
> int i,j;
> int x1[2],y1[2],x2[2],y2[2],A[2],B[2],C[2];
> 
> int main()
> {
> 	int n;
> 	scanf("%d",&n);
> 	puts("INTERSECTING LINES OUTPUT");
> 	while(n--)
> 	{
>     	for(i=0;i<2;i++)
>     	{
>     		scanf("%d%d%d%d",(x1+i),(y1+i),(x2+i),(y2+i));
>     		A[i]=y2[i]-y1[i];
>     		B[i]=x1[i]-x2[i];
>     		C[i]=y1[i]*(x2[i]-x1[i])-x1[i]*(y2[i]-y1[i]);
>     	}
>     	
>     	if(A[1]*B[0]==A[0]*B[1])
>     	{
>     		if(A[1]*C[0]==A[0]*C[1])
>     			puts("LINE");
>     		else
>     			puts("NONE");
>     	}
>     	else
>     	{
>     		double a,b;
>     		a=(double)( B[1]*C[0]-B[0]*C[1] )/( A[1]*B[0]-A[0]*B[1] );
>     		b=(double)( A[1]*C[0]-A[0]*C[1] )/( B[1]*A[0]-B[0]*A[1] );
>     		
>     		printf("POINT %.2f %.2f\n",a,b);
>     	}
> 	}
> 	puts("END OF OUTPUT");
> //	while(getchar()!=EOF);
> 	return 0;
> }

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