#include <bits/stdc++.h> #define INF 0x3f3f3f using namespace std; double ks(double x1,double y1,double x2,double y2){ double k; if(x2-x1==0&&y2-y1!=0) k=INF; else if(x2-x1==0&&y2-y1==0) k=0; else if(x2-x1!=0) k=(y2-y1)/(x2-x1); return k; } int main(){ double x1,y1,x2,y2,x3,y3,x4,y4; while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){ double k1,k2,k3; k1=ks(x1,y1,x2,y2); k2=ks(x3,y3,x4,y4); if(k1!=k2)cout<<"Yes"<<endl; else if(k1==k2){ if(x3-x1==0&&y3-y1==0) cout<<"Yes"<<endl; else{ k3=ks(x1,y1,x3,y3); if(k1==k3) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } } } |
Double click to view unformatted code.