HLG1291

#include <iostream>
#include <stdio.h>
#include <string.h>




using namespace std;


struct point
{
    int x,y;


}mp,p[100];


int cross(int x0,int y0,int x1,int y1)
{
    return (x1-x0)*(mp.y-y0)-(mp.x-x0)*(y1-y0); //叉积
}


int main()
{
    int n;
    bool flag;
    while(cin>>n>>mp.x>>mp.y)
    {
        flag = true;
        


        for( int i = 0; i < n; i++)
           scanf("%d%d",&p[i].x, &p[i].y);
        for( int i = 0; i< n-1; i++)
        {
            if(cross(p[i].x,p[i].y,p[i+1].x,p[i+1].y)<0)   //逆时针
                //cout<<"Yes"<<endl;
            
                 {
                     flag=false;
                     break;
                 } 
            


        }


     if(flag)
        {
            if(cross(p[n-1].x,p[n-1].y,p[0].x,p[0].y)>=0)
                cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
}





你可能感兴趣的:(HLG1291)