https://www.nowcoder.com/acm/contest/118/C

#include"bits/stdc++.h"
using namespace std;
struct Point
{
    double x,y;
    Point (){}
    Point(double x,double y):x(x),y(y){}
};
struct Vector
{
    Point p1,p2;
    Vector(){}
    Vector(Point p1,Point p2):p1(p1),p2(p2){}
};
int whichSide(Point p,Vector v)
{
    double x1=v.p1.x,y1=v.p1.y,x2=v.p2.x,y2=v.p2.y,x=p.x,y=p.y;
    if((x2-x1)*(y-y1)-(x-x1)*(y2-y1)<0)return 0;
    else return 1;
}
int main()
{
    double x[4],y[4];
    while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3])
    {
        Point P[4];
        P[0]=Point(x[0],y[0]);
        P[1]=Point(x[1],y[1]);
        P[2]=Point(x[2],y[2]);
        P[3]=Point(x[3],y[3]);
        Vector P12(P[1],P[2]),P23(P[2],P[3]),P31(P[3],P[1]);
        int sum=0;
        sum+=whichSide(P[0],P12);
        sum+=whichSide(P[0],P23);
        sum+=whichSide(P[0],P31);
        if(sum==0||sum==3)cout<<"Yes\n";
        else cout<<"No\n";
    }
}