10分求助,谢谢大佬们

P1355 神秘大三角

淦,代码炸了 ```cpp #include<iostream> #include<cstdlib> using namespace std; struct Point{ int x,y; friend Point operator +(Point a,Point b){ Point tmp; tmp.x=a.x+b.x; tmp.y=a.y+b.y; return tmp; } friend Point operator -(Point a,Point b){ Point tmp; tmp.x=a.x-b.x; tmp.y=a.y-b.y; return tmp; } friend int operator *(Point a,Point b){ return a.x*b.x+a.y+b.y; } friend bool operator ==(Point a,Point b){ return (a.x==b.x&&a.y==b.y); } friend ostream& operator<<(ostream &a,Point b){ cout<<b.x<<" "<<b.y; } friend int cross(Point a,Point b){ return a.x*b.y-a.y*b.x; } friend double cross(Point a,Point b,Point c){ return cross((c-a),(c-b)); } }; Point p[5]; void init_(){ for(int i=1;i<=4;i++){ cin.ignore(); cin>>p[i].x; cin.ignore(); cin>>p[i].y; cin.ignore(); cin.ignore(); //cout<<p[i]; } for(int i=1;i<=3;i++){ if(p[4]==p[i]){ cout<<4; exit(0); } } } int main(){ init_(); int a=cross(p[1],p[2],p[4]),b=cross(p[2],p[3],p[4]),c=cross(p[3],p[1],p[4]); //cout<<a<<" "<<" "<<b<<" "<<c; if((a>0&&b>0&&c>0)||(a<0&&b<0&&c<0)){ cout<<1; }else if((a==0&&(p[4]-p[1])*(p[4]-p[2])<0)||b==0&&(p[4]-p[2])*(p[4]-p[3])<0||c==0&&(p[4]-p[3])*(p[4]-p[1])<0){ cout<<3; }else{ cout<<2; } } ```
by tamamocross @ 2023-05-21 11:01:16


@[zhzkiller](/user/764944) 您发的东西看不见
by tamamocross @ 2023-05-21 11:15:17


@[tamamocross](/user/754444) 注意整齐
by Patrick_Liu_Bingxian @ 2023-05-21 11:24:17


@[Patrick_Liu_Bingxian](/user/915569) 后面补了
by tamamocross @ 2023-05-21 11:33:28


|