二维
struct vec{
int x,y;
vec(int a=0,int b=0):x(a),y(b){}
};
vec operator + (const vec &a,const vec &b){
return vec(a.x+b.x,a.y+b.y);
}
vec operator - (const vec &a,const vec &b){
return vec(a.x-b.x,a.y-b.y);
}
vec operator * (const vec &a,const int &k){
return vec(a.x*k,a.y*k);
}
ll dot(const vec &a,const vec &b){
return 1ll*a.x*b.x+1ll*a.y*b.y;
}
ll cross(const vec &a,const vec &b){
return 1ll*a.x*b.y-1ll*a.y*b.x;
}
ll dis2(const vec &a){
return dot(a,a);
}
标签:return,--,ll,1ll,zhengjun,int,vec,const,模板
From: https://www.cnblogs.com/A-zjzj/p/17756878.html