Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double area(double ax,double ay,double bx,double by,double cx,double cy) {
- return abs((by-ay)*(cx-ax)-(bx-ax)*(cy-ay));
- }
- bool resh(double ax, double ay, double bx, double by, double cx, double cy, double px, double py){
- double s=area(ax,ay,bx,by,cx,cy),s1=area(ax,ay,bx,by,px,py),s2=area(bx,by,cx,cy,px,py),s3=area(cx,cy,ax,ay,px,py);
- if (s1+s2+s3-s<=0) return true; else return false;
- }
- int main()
- {
- double pointx, pointy;
- cin >> pointx >> pointy;
- // resh(точка A, точка B, точка C, произвольная точка) ( по две координаты)
- if(resh(1,1,2,1,1.5,2,pointx, pointy) or resh(1,2,2,2,1.5,3,pointx, pointy) or resh(1,3,2,3,1.5,4,pointx, pointy)) cout << "Yes";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement