Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- #include <iomanip>
- using namespace std;
- struct otrezok
- {
- public:
- double x1, y1, x2, y2, x, y;
- double length;
- otrezok(double x1, double x2,double y1,double y2)
- {
- length = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
- }
- };
- struct direct
- {
- double a = 0, b = 0, c = 0;
- double parametr = INT16_MAX;
- };
- struct vershina
- {
- double x, y;
- };
- direct storona (vershina first, vershina second)
- {
- direct stright;
- stright.a = (first.y - second.y);
- stright.b = (second.x - first.x);
- stright.c = first.x*second.y - second.x*first.y;
- return stright;
- }
- int main ()
- {
- vershina A, B, C, D, X;
- cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
- cin >> X.x >> X.y;
- direct AB = storona (A, B);
- direct BC = storona (B, C);
- direct CD = storona (D, C);
- direct DA = storona (A, D);
- // cout << BC.a << " " << BC.b << " " << BC.c << " ";
- double znach_1 = AB.a*X.x + AB.b*X.y + AB.c;
- double znach_2 = BC.a*X.x + BC.b*X.y + BC.c;
- double znach_3 = CD.a*X.x + CD.b*X.y + CD.c;
- double znach_4 = DA.a*X.x + DA.b*X.y + DA.c;
- //cout << znach_1 << znach_2 << znach_3 << znach_4;
- if (znach_1 <= 0 && znach_2 <= 0 && znach_3 >= 0 && znach_4 >= 0)
- cout << "Yes";
- else cout << "No";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement