有没有大佬看看为什么我这段代码不通过;
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
class Point
{
private:
int x,y;
char type;
public:
Point()
{
this->x = 0;
this->y = 0;
this->type = 'N';
}
Point(int x, int y,char type)
{
this->x = x;
this->y = y;
this->type = type;
}
int getX()
{
return x;
}
int getY()
{
return y;
}
char getType()
{
return type;
}
};
int main()
{
int n,m;
int x,y;
int a,b,c;
int flag=0;
char type,type1,type2;
Point poit[1000];//动态的怎么创建忘了???
//Point point = new Point[];
cin>>n>>m;
for(int i=0; i<n; i++)
{
cin>>x>>y>>type;
poit[i]=Point(x,y,type);
}
for(int l=0; l<m; l++)
{
flag = 1;
cin>>a>>b>>c;
if(a+b*poit[0].getX()+c*poit[0].getY()<0)
{
type1 = poit[0].getType();
}
else
{
type2 = poit[0].getType();
}
if(type1=='A')
type2='B';
else
{
type1='B';
type2='A';
}
for(int j=0; j<n; j++)
{
if(a+b*poit[j].getX()+c*poit[j].getY()<0)
{
if(poit[j].getType()!=type1)
{
cout<<"No"<<endl;
flag = 0;
break;
}
}
else if(a+b*poit[j].getX()+c*poit[j].getY()>0)
{
if(poit[j].getType()!=type2)
{
cout<<"No"<<endl;
flag = 0;
break;
}
}
}
if(flag == 1)
{
cout<<"Yes"<<endl;
}
}
return 0;
}
到底哪里出问题了????
。。。。