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

过了sample就对,那还要oj做什么?

Posted by semonteer at 2005-10-03 18:37:52 on Problem 2624
In Reply To:Re:验证数据都对,怎么就wa了呢/ Posted by:HBU_try at 2005-10-03 18:36:26
> #include "iostream.h"
> #include "stdio.h"
> 
> int main(int argc, char* argv[])
> {
> 	double x[4],y[4],a,b,k[2];
> 	while(cin>>x[0]>>y[0])
> 	{
> 		for(int i=1;i<=3;i++)
> 			cin>>x[i]>>y[i];
>     	
> 		if((x[0]-x[1]!=0)&&((x[2]-x[3])!=0))
> 		{	k[0]=(y[0]-y[1])/(x[0]-x[1]);
>     	    k[1]=(y[1]-y[3])/(x[1]-x[3]);
> 			a=(y[3]-y[0]+x[0]*k[1]-x[3]*k[0])/(k[1]-k[0]);
> 	//		b=-(k[0]*x[3]-a*k[0]+y[3]);
> 			b=y[0]-k[1]*x[0]+a*k[1];
> 		}else
> 			if((x[0]-x[1]==0)&&((x[2]-x[3])!=0))
> 			{
> 				a=x[3];
> 				b=y[3]-y[1]+y[0];
> 			}else
> 				if((x[0]-x[1]!=0)&&((x[2]-x[3])==0))
> 				{
> 					a=x[0]-x[1]+x[3];
> 					b=y[0];
> 				}else 
> 				{
> 					a=x[3];
> 					b=y[0];
> 				}
> 
> 
> 		printf("%.3f %.3f\n",a,b);
> 	}
> 	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