吉如一几何板子

时间:2022-02-21 12:01:52
【文件属性】:

文件名称:吉如一几何板子

文件大小:23KB

文件格式:CPP

更新时间:2022-02-21 12:01:52

c++ algorithm

2018 world final 金牌 吉老师几何板子 struct point{ db x,y; point operator + (const point &k1;) const{return (point){k1.x+x,k1.y+y};} point operator - (const point &k1;) const{return (point){x-k1.x,y-k1.y};} point operator * (db k1) const{return (point){x*k1,y*k1};} point operator / (db k1) const{return (point){x/k1,y/k1};} int operator == (const point &k1;) const{return cmp(x,k1.x)==0&&cmp;(y,k1.y)==0;} point turn(db k1){return (point){x*cos(k1)-y*sin(k1),x*sin(k1)+y*cos(k1)};} point turn90(){return (point){-y,x};} bool operator < (const point k1) const{ int a=cmp(x,k1.x); if (a==-1) return 1; else if (a==1) return 0; else return cmp(y,k1.y)==-1; } db abs(){return sqrt(x*x+y*y);} db abs2(){return x*x+y*y;} db dis(point k1){return ((*this)-k1).abs();} point unit(){db w=abs(); return (point){x/w,y/w};} void scan(){double k1,k2; scanf("%lf%lf",&k1;,&k2;); x=k1; y=k2;} void print(){printf("%.11lf %.11lf\n",x,y);} db getw(){return atan2(y,x);} point getdel(){if (sign(x)==-1||(sign(x)==0&&sign;(y)==-1)) return (*this)*(-1); else return (*this);} int getP() const{return sign(y)==1||(sign(y)==0&&sign;(x)==-1);} };


网友评论