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 ...

Closed due to the fact that YuriySPb March 25 at 2:12 pm is off topic.

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Yuriy SPb
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And if the lines are parallel? The determinant should be equal to zero, divide into it - infinity turns out ... - alexlz
  • Everything seems to be correct, which test fails? - VladD
  • there is only an algorithm for the intersection of two segments, and moreover on javascript. But I think the principle is the same: pastebin.com/BCQFh2tY - lampa
  • en.wikipedia.org/wiki/Line-line_intersection here's a good, valid article with the condition of parallelism in addition - igumnov
  • one
    Wait, what's the question then? "Make sure that the test passes, and which one, I will not tell you." - VladD