Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdio>
- using namespace std;
- double getS(double ax, double ay, double bx, double by);
- int main(){
- double cx, cy, ax, ay, bx, by;
- cin >> cx >> cy >> ax >> ay >> bx >> by;
- bx -= ax;
- cx -= ax;
- by -= ay;
- cy -= ay;
- if (bx * cx + by * cy >= 0)
- cout << abs(getS(bx, by, cx, cy)) / sqrt(bx * bx + by * by);
- else
- cout << sqrt(cx * cx + cy * cy) << endl;
- return 0;
- }
- double getS(double ax, double ay, double bx, double by){
- return (bx * ay - ax * by);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement