include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int main() {
float x1, y1, x2, y2, x3, y3, x4, y4;
float x_res, y_res;
float k1, k2;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
if (x1 == x2 && x3 != x4) { //直线1垂直,直线2不垂直
k2 = (y3 - y4) / (x3 - x4);
x_res = x1;
y_res = k2 * (x_res - x3) + y3;
}
else if (x1 != x2 && x3 == x4) { //直线1不垂直,直线2垂直
k1 = (y2 - y1) / (x2 - x1);
x_res = x3;
y_res = k1 * (x_res - x1) + y1;
}
else if (x1 == x2 && x3 == x4) { //两个直线都垂直
cout << "Parallel or coincident";
return 0;
}
else { //两个直线都不垂直
k1 = (y2 - y1) / (x2 - x1);
k2 = (y3 - y4) / (x3 - x4);
if (k1 == k2) { //两个直线平行
cout << "Parallel or coincident";
return 0;
}
//两个直线不平行
x_res = (k1 * x1 - k2 * x3 - y1 + y3) / (k1 - k2);
y_res = k1 * (x_res - x1) + y1;
}
cout << setiosflags(ios::fixed) << setprecision(2);
cout << x_res << " " << y_res;
return 0;
}