View Code of Problem 67

#include<stdio.h>//直线相交需考虑重合问题 
int main()
{
	int a,b,c,d;
	int e,f,g,h;
	double k1,k2;
	while( scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g,&h)!=EOF )
	{
		if( a!=c && e!=g )
		{
			k1 = 1.0*(d-b)/(c-a);
			k2 = 1.0*(h-f)/(g-e);
			if(k1 == k2)
			{
				if(b-a*k1==f-e*k2)
				printf("Yes\n");
				else
				printf("No\n");
			}
			else
			{
				printf("Yes\n");
			}
		}
	  else if(a==c&&e==g)
		{
			if(a==e)
			 printf("Yes\n");
			else
			  printf("No\n");
		 } 
	 else
		 {
		 	printf("Yes\n");
		 }
	}
	return 0;
 } 

Double click to view unformatted code.


Back to problem 67