Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define sqr(a) ((a)*(a))
- typedef long double ld;
- ld d(ld x, ld y, ld a, ld b, ld c)
- {
- return (abs(a*x + b*y + c) / sqrt(a*a + b*b));
- }
- int main()
- {
- ifstream cin("input.txt");
- int x, y, x1, y1, x2, y2;
- long double a, b, c;
- cin >> x >> y >> x1 >> y1 >> x2 >> y2;
- a = (y2 - y1);
- b = (x1 - x2);
- c = (x2*y1 - x1*y2);
- cout << fixed << setprecision(60) << abs(d(x, y, a, b, c)) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement