Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- cout << fixed << setprecision(47);
- long long x, y, a, b, c, z, t, d, e, f, k, l, m, n, p;
- long double r, s;
- p=0;
- cin >> x;
- cin >> y;
- cin >> z;
- cin >> t;
- cin >> k;
- cin >> l;
- cin >> m;
- cin >> n;
- a=y-t;
- b=z-x;
- c=-a*x-b*y;
- d=l-n;
- e=m-k;
- f=-d*k-e*l;
- if(a*e==d*b)
- {
- if(f*a==c*d && f*b==c*e) {cout << 2; p=1;}
- else
- {
- cout << 0;
- }
- }
- else
- {
- cout << 1 << ' ';
- s=(long double)(f*a-c*d)/(b*d-e*a);
- r=(long double)(f*b-c*e)/(-b*d+e*a);
- cout << r << ' ' << s;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement