2 straight lines are given by 4 points, it is known that they intersect, find the intersection point! fails one test, help out! I can not understand where the error? Already the whole hour reviewed everything in literature, the same thing they write ...
int det( int a1, int a2, int b1, int b2 ) { return a1 * b2 - a2 * b1; } void input ( int &a, int &b, int &c ) { int x0, y0, x1, y1; std::cin >> x0 >> y0 >> x1 >> y1; a = y1 - y0; b = x0 - x1; c = -((x1 - x0) * y0 - (y1 - y0) * x0); } int main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); input( a1, b1, c1 ); input( a2, b2, c2 ); d = det( a1, b1, a2, b2 ); d1 = det( c1, b1, c2, b2 ); d2 = det( a1, c1, a2, c2 ); printf("1 %.10lf %.10lf", (double) d1 / d, (double) d2 / d); return 0; }
проблема заключалась у тестирующей системы, у них в тесте была ошибка с точностью, вот и не проходила программа, видимо где то терялась тысячную часть ответа...! всем спасибо за помощь
I think that the question can be closed ...