#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main(){ int x1,x2,x3,x4,y1,y2,y3,y4; while(scanf("%d %d %d %d",&x1,&y1,&x2,&y2)!=EOF &&scanf("%d %d %d %d",&x3,&y3,&x4,&y4)!=EOF){ if(x1==x2){ if(x3==x4){ if(x1==x3){ printf("Yes\n"); }else{ printf("No\n"); } }else{ printf("Yes\n"); } }else if(y1==y2){ if(y3==y4){ if(y3==y1){ printf("Yes\n"); }else{ printf("No\n"); } }else{ printf("Yes\n"); } }else{ if(y3==y4||x3==x4){ printf("Yes\n"); }else{ double k1=(y2-y1)*1.0/(x2-x1); double k2=(y4-y3)*1.0/(x4-x3); if(k1!=k2){ printf("Yes\n"); } else{ int dis=y4-y1; if(dis==k1*(x4-x1)){ printf("Yes\n"); }else{ printf("No\n"); } } } } } } |
Double click to view unformatted code.