View Code of Problem 67

#include<stdio.h>
#include<string.h>
int main()
{
	int x1,x2,x3,x4,y1,y2,y3,y4;
	float a,b,m,n;
	while(scanf("%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)!=EOF)
	{
		if(x1==x2)
        {
			m=x3-x1;
			n=x4-x1;
		  if(((m>0&&n>0)||(m<0&&n<0))&&x3==x4)
			printf("No\n");
		  else
			printf("Yes\n");
		}
		else
		{
		  a=(y1-y2)*1.0/(x1-x2);
		  b=y1-a*x1;
          m=(y3-y4)*1.0/(x3-x4);
		  n=y2-m*x3;
		  if(a==m&&b!=n)
			printf("No\n");
		  else
			printf("Yes\n");
		}
		
		
		

	}
	return 0;
}

Double click to view unformatted code.


Back to problem 67