几何基础专题

  • UVA 11437 Triangle Fun
  • UVA 11800 Determine the Shape 四边形判定
  • UVA 11646 Athletics Track
  • UVA 11817 Tunnelling the Earth 球面距离
  • UVA 1473 Dome of Circus
  • UVA 11524 InCircle
  • UVA 11731 Ex-circles 旁切圆
  • UVA 12300 Smallest Regular Polygon
  • UVA 10566 Crossed Ladders
  • UVA 11186 Circum Triangle
  • UVA 12165 Triangle Hazard

UVA 11437 Triangle Fun

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
ll sqr(ll a){return a*a;}
ld sqr(ld a){return a*a;}
double sqr(double a){return a*a;}

ld PI = 3.141592653589793238462643383;
class P{
public:
    double x,y;
    P(double x=0,double y=0):x(x),y(y){}
    friend long double dis2(P A,P B){return sqr(A.x-B.x)+sqr(A.y-B.y);  }
    friend long double Dot(P A,P B) {return A.x*B.x+A.y*B.y; }
    friend long double Length(P A) {return sqrt(Dot(A,A)); }
    friend long double Angle(P A,P B) {return acos(Dot(A,B) / Length(A) / Length(B) ); }

    friend P operator- (P A,P B) { return P(A.x-B.x,A.y-B.y); }
    friend P operator+ (P A,P B) { return P(A.x+B.x,A.y+B.y); }
    friend P operator* (P A,double p) { return P(A.x*p,A.y*p); }
    friend P operator/ (P A,double p) { return P(A.x/p,A.y/p); }
    friend bool operator< (const P& a,const P& b) {return a.x<b.x||(a.x==b.x&& a.y<b.y);}

};
const double eps=1e-10;
int dcmp(double x) {
    if (fabs(x)<eps) return 0; else return x<0 ? -1 : 1;
}
bool operator==(const P& a,const P& b) {
    return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y) == 0;
}
typedef P V;

double Cross(V A,V B) {return A.x*B.y - A.y*B.x;}
double Area2(P A,P B,P C) {return Cross(B-A,C-A);}
V Rotate(V A,double rad) {
    return V(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
}
// A 不是 0向量
V Normal(V A) {
    double L = Length(A);
    return V(-A.y/L , A.x/L);
}

namespace complex_G{
    typedef complex<double> Point;
    //real(p):实部 imag(p):虚部 conj(p):共轭
    typedef Point Vector;
    double Dot(Vector A,Vector B) {return real(conj(A)*B); }
    double Cross(Vector A,Vector B) {return imag(conj(A)*B); }
    Vector Rotate(Vector A,double rad) {return A*exp(Point(0,rad)); }
}
//Cross(v,w)==0(平行)时,不能调这个函数
P GetLineIntersection(P p,V v,P Q,V w){
    V u = p-Q;
    double t = Cross(w,u)/Cross(v,w);
    return p+v*t;
}
P GetLineIntersectionB(P p,V v,P Q,V w){
    return GetLineIntersection(p,v-p,Q,w-Q);
}

double DistanceToLine(P p,P A,P B) {
    V v1 = B-A, v2 = p-A;
    return fabs(Cross(v1,v2))/Length(v1);
}
double DistanceToSegment(P p,P A,P B) {
    if (A==B) return Length(p-A);
    V v1 = B-A, v2 = p-A, v3 = p - B;
    if (dcmp(Dot(v1,v2))<0) return Length(v2);
    else if (dcmp(Dot(v1,v3))>0 ) return Length(v3);
    else return fabs(Cross(v1,v2) ) / Length(v1);
}
P GetLineProjection(P p,P A,P B) {
    V v=B-A;
    return A+v*(Dot(v,p-A)/Dot(v,v));
}
//规范相交-线段相交且交点不在端点
bool SegmentProperIntersection(P a1,P a2,P b1,P b2) {
    double  c1 = Cross(a2-a1,b1-a1) , c2 = Cross(a2-a1,b2-a1),
            c3 = Cross(b2-b1,a1-b1) , c4 = Cross(b2-b1,a2-b1);
    return dcmp(c1)*dcmp(c2)<0 && dcmp(c3)*dcmp(c4)<0;
}
//点在线段上(不包含端点)
bool OnSegment(P p,P a1,P a2) {
    return dcmp(Cross(a1-p,a2-p)) == 0 && dcmp(Dot(a1-p,a2-p))<0;
}
double PolygonArea(P *p,int n) {
    double area=0;
    For(i,n-2) area+=Cross(p[i]-p[0],p[i+1]-p[0]);
    return area/2;
} 

/*欧拉公式: V+F-E=2
V-点数 F面数 E边数 */
P read_point() {
    P a;
    scanf("%lf%lf",&a.x,&a.y);
    return a;
}
struct C{
    P c;
    double r,x,y;
    C(P c,double r):c(c),r(r),x(c.x),y(c.y){}
    P point(double a) {
        return P(c.x+cos(a)*r,c.y+sin(a)*r);
    }
};

struct Line{
    P p;
    V v;
    double ang;
    Line(){}
    Line(P p,V v):p(p),v(v) {ang=atan2(v.y,v.x); }
    bool operator<(const Line & L) const {
        return ang<L.ang;
    }
    P point(double a) {
        return p+v*a;
    }
};
int getLineCircleIntersection(Line L,C cir,double &t1,double &t2,vector<P> & sol) {
    if (dcmp(DistanceToLine(cir.c,L.p,L.p+L.v)-cir.r)==0) {
        sol.pb(GetLineProjection(cir.c,L.p,L.p+L.v));
        return 1;
    }

    double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d= L.p.y - cir.c.y;
    double e = a*a+c*c, f = 2*(a*b + c*d), g = b*b+d*d-cir.r*cir.r;
    double delta = f*f - 4*e*g;
    if (dcmp(delta)<0) return 0;
    else if (dcmp(delta)==0) {
        t1 = t2 = -f / (2*e); sol.pb(L.point(t1));
        return 1;
    }
    t1 = (-f - sqrt(delta)) / (2*e); sol.pb(L.point(t1));
    t2 = (-f + sqrt(delta)) / (2*e); sol.pb(L.point(t2));
    return 2;
}
double angle(V v) {return atan2(v.y,v.x);}
int getCircleCircleIntersection(C C1,C C2,vector<P>& sol) {
    double d = Length(C1.c-C2.c);
    if (dcmp(d)==0) {
        if (dcmp(C1.r - C2.r)==0) return -1; //2圆重合
        return 0;
    }
    if (dcmp(C1.r+C2.r-d)<0) return 0;
    if (dcmp(fabs(C1.r-C2.r)-d)>0) return 0;

    double a = angle(C2.c-C1.c);
    double da = acos((C1.r*C1.r+d*d - C2.r*C2.r)/ (2*C1.r*d));
    P p1 = C1.point(a-da), p2 = C1.point(a+da);
    sol.pb(p1);
    if (p1==p2) return 1;
    sol.pb(p2);
    return 2;
}
// Tangents-切线
int getTangents(P p,C c,V* v) {
    V u= c.c-p;
    double dist = Length(u);
    if (dist<c.r) return 0;
    else if (dcmp(dist-c.r)==0) {
        v[0]=Rotate(u,PI/2);
        return 1;
    } else {
        double ang = asin(c.r / dist);
        v[0]=Rotate(u,-ang);
        v[1]=Rotate(u,ang);
        return 2;
    }
}
//这个函数假设整数坐标和整数半径
//double时要把int改成double
int getTangents(C A,C B,P* a,P* b) {
    int cnt=0;
    if (A.r<B.r) {swap(A,B),swap(a,b);}
    int d2 = (A.c.x-B.c.x)*(A.c.x-B.c.x) + (A.c.y-B.c.y)*(A.c.y-B.c.y);
    int rdiff = A.r-B.r;
    int rsum = A.r+B.r;
    if (d2<rdiff*rdiff) return 0;
    double base = atan2(B.y-A.y,B.x-A.x);
    if (d2==0 && A.r == B.r) return -1;
    if (d2 == rdiff*rdiff) {
        a[cnt] = A.point(base); b[cnt] = B.point(base); ++cnt;
        return 1;
    }
    double ang = acos((A.r-B.r)/sqrt(d2));
    a[cnt] = A.point(base+ang); b[cnt] = B.point(base+ang); ++cnt;
    a[cnt] = A.point(base-ang); b[cnt] = B.point(base-ang); ++cnt;
    if (d2==rsum*rsum) {
        a[cnt] = A.point(base); b[cnt] = B.point(PI+base); ++cnt;
    }
    else if (d2>rsum*rsum) {
        double ang = acos((A.r+B.r)/sqrt(d2));
        a[cnt] = A.point(base+ang); b[cnt] = B.point(PI+base+ang); ++cnt;
        a[cnt] = A.point(base-ang); b[cnt] = B.point(PI+base-ang); ++cnt;
    }
    return cnt;
}
//Circumscribed-外接
C CircumscribedCircle(P p1,P p2,P p3) {
    double Bx = p2.x-p1.x, By= p2.y-p1.y;
    double Cx = p3.x-p1.x, Cy= p3.y-p1.y;
    double D = 2*(Bx*Cy-By*Cx);
    double cx = (Cy*(Bx*Bx+By*By)-By*(Cx*Cx+Cy*Cy))/D + p1.x;
    double cy = (Bx*(Cx*Cx+Cy*Cy)-Cx*(Bx*Bx+By*By))/D + p1.y;
    P p =P(cx,cy);
    return C(p,Length(p1-p));
}
//Inscribed-内接
C InscribedCircle(P p1,P p2,P p3) {
    double a = Length(p2-p3);
    double b = Length(p3-p1);
    double c = Length(p1-p2);
    P p = (p1*a+p2*b+p3*c)/(a+b+c);
    return C(p,DistanceToLine(p,p1,p2));
}
double torad(double deg) {
    return deg/180*acos(-1);
}
//把 角度+-pi 转换到 [0,pi) 上
double radToPositive(double rad) {
    if (dcmp(rad)<0) rad=ceil(-rad/PI)*PI+rad;
    if (dcmp(rad-PI)>=0) rad-=floor(rad/PI)*PI;
    return rad;
}
double todeg(double rad) {
    return rad*180/acos(-1);
}

//(R,lat,lng)->(x,y,z)
void get_coord(double R,double lat,double lng,double &x,double &y,double &z) {
    lat=torad(lat);
    lng=torad(lng);
    x=R*cos(lat)*cos(lng);
    y=R*cos(lat)*sin(lng);
    z=R*sin(lat);
}
void print(double a) {
    printf("%.6lf",a);
}
void print(P p) {
    printf("(%.6lf,%.6lf)",p.x,p.y);
}
template<class T>
void print(vector<T> v) {
    sort(v.begin(),v.end());
    putchar(‘[‘);
    int n=v.size();
    Rep(i,n) {
        print(v[i]);
        if (i<n-1) putchar(‘,‘);
    }
    puts("]");
}
// 把直线沿v平移
// Translation-平移
Line LineTranslation(Line l,V v) {
    l.p=l.p+v;
    return l;
}
void CircleThroughAPointAndTangentToALineWithRadius(P p,Line l,double r,vector<P>& sol) {
    V e=Normal(l.v);
    Line l1=LineTranslation(l,e*r),l2=LineTranslation(l,e*(-r));
    double t1,t2;
    getLineCircleIntersection(l1,C(p,r),t1,t2,sol);
    getLineCircleIntersection(l2,C(p,r),t1,t2,sol);
}
void CircleTangentToTwoLinesWithRadius(Line l1,Line l2,double r,vector<P>& sol) {
    V e1=Normal(l1.v),e2=Normal(l2.v);
    Line L1[2]={LineTranslation(l1,e1*r),LineTranslation(l1,e1*(-r))},
         L2[2]={LineTranslation(l2,e2*r),LineTranslation(l2,e2*(-r))};
    Rep(i,2) Rep(j,2) sol.pb(GetLineIntersection(L1[i].p,L1[i].v,L2[j].p,L2[j].v));
}
void CircleTangentToTwoDisjointCirclesWithRadius(C c1,C c2,double r,vector<P>& sol) {
    c1.r+=r; c2.r+=r;
    getCircleCircleIntersection(c1,c2,sol);
}

P getP(P A,P B,P C) {
    P D=B+(C-B)/3;
    P E=C+(A-C)/3;
    return GetLineIntersection(A,D-A,B,E-B);

}
int main()
{
//  freopen("uva11437.in","r",stdin);
//  freopen(".out","w",stdout);

    int T=read();
    while(T--){
        P A=read_point(),B=read_point(),C=read_point();
        P p[3]={getP(A,B,C),getP(B,C,A),getP(C,A,B)};
        printf("%0.lf\n",PolygonArea(p,3));
    }

    return 0;
}

UVA 11800 Determine the Shape 四边形判定

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
ll sqr(ll a){return a*a;}
ld sqr(ld a){return a*a;}
double sqr(double a){return a*a;}

ld PI = 3.141592653589793238462643383;
class P{
public:
    double x,y;
    P(double x=0,double y=0):x(x),y(y){}
    friend long double dis2(P A,P B){return sqr(A.x-B.x)+sqr(A.y-B.y);  }
    friend long double Dot(P A,P B) {return A.x*B.x+A.y*B.y; }
    friend long double Length(P A) {return sqrt(Dot(A,A)); }
    friend long double Angle(P A,P B) {return acos(Dot(A,B) / Length(A) / Length(B) ); }

    friend P operator- (P A,P B) { return P(A.x-B.x,A.y-B.y); }
    friend P operator+ (P A,P B) { return P(A.x+B.x,A.y+B.y); }
    friend P operator* (P A,double p) { return P(A.x*p,A.y*p); }
    friend P operator/ (P A,double p) { return P(A.x/p,A.y/p); }
    friend bool operator< (const P& a,const P& b) {return a.x<b.x||(a.x==b.x&& a.y<b.y);}

};
const double eps=1e-10;
int dcmp(double x) {
    if (fabs(x)<eps) return 0; else return x<0 ? -1 : 1;
}
bool operator==(const P& a,const P& b) {
    return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y) == 0;
}
typedef P V;

double Cross(V A,V B) {return A.x*B.y - A.y*B.x;}
double Area2(P A,P B,P C) {return Cross(B-A,C-A);}
V Rotate(V A,double rad) {
    return V(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
}
// A 不是 0向量
V Normal(V A) {
    double L = Length(A);
    return V(-A.y/L , A.x/L);
}

namespace complex_G{
    typedef complex<double> Point;
    //real(p):实部 imag(p):虚部 conj(p):共轭
    typedef Point Vector;
    double Dot(Vector A,Vector B) {return real(conj(A)*B); }
    double Cross(Vector A,Vector B) {return imag(conj(A)*B); }
    Vector Rotate(Vector A,double rad) {return A*exp(Point(0,rad)); }
}
//Cross(v,w)==0(平行)时,不能调这个函数
P GetLineIntersection(P p,V v,P Q,V w){
    V u = p-Q;
    double t = Cross(w,u)/Cross(v,w);
    return p+v*t;
}
P GetLineIntersectionB(P p,V v,P Q,V w){
    return GetLineIntersection(p,v-p,Q,w-Q);
}

double DistanceToLine(P p,P A,P B) {
    V v1 = B-A, v2 = p-A;
    return fabs(Cross(v1,v2))/Length(v1);
}
double DistanceToSegment(P p,P A,P B) {
    if (A==B) return Length(p-A);
    V v1 = B-A, v2 = p-A, v3 = p - B;
    if (dcmp(Dot(v1,v2))<0) return Length(v2);
    else if (dcmp(Dot(v1,v3))>0 ) return Length(v3);
    else return fabs(Cross(v1,v2) ) / Length(v1);
}
P GetLineProjection(P p,P A,P B) {
    V v=B-A;
    return A+v*(Dot(v,p-A)/Dot(v,v));
}
//规范相交-线段相交且交点不在端点
bool SegmentProperIntersection(P a1,P a2,P b1,P b2) {
    double  c1 = Cross(a2-a1,b1-a1) , c2 = Cross(a2-a1,b2-a1),
            c3 = Cross(b2-b1,a1-b1) , c4 = Cross(b2-b1,a2-b1);
    return dcmp(c1)*dcmp(c2)<0 && dcmp(c3)*dcmp(c4)<0;
}
//点在线段上(不包含端点)
bool OnSegment(P p,P a1,P a2) {
    return dcmp(Cross(a1-p,a2-p)) == 0 && dcmp(Dot(a1-p,a2-p))<0;
}
double PolygonArea(P *p,int n) {
    double area=0;
    For(i,n-2) area+=Cross(p[i]-p[0],p[i+1]-p[0]);
    return area/2;
}
/*欧拉公式: V+F-E=2
V-点数 F面数 E边数 */
P read_point() {
    P a;
    scanf("%lf%lf",&a.x,&a.y);
    return a;
}
struct C{
    P c;
    double r,x,y;
    C(P c,double r):c(c),r(r),x(c.x),y(c.y){}
    P point(double a) {
        return P(c.x+cos(a)*r,c.y+sin(a)*r);
    }
};

struct Line{
    P p;
    V v;
    double ang;
    Line(){}
    Line(P p,V v):p(p),v(v) {ang=atan2(v.y,v.x); }
    bool operator<(const Line & L) const {
        return ang<L.ang;
    }
    P point(double a) {
        return p+v*a;
    }
};
int getLineCircleIntersection(Line L,C cir,double &t1,double &t2,vector<P> & sol) {
    if (dcmp(DistanceToLine(cir.c,L.p,L.p+L.v)-cir.r)==0) {
        sol.pb(GetLineProjection(cir.c,L.p,L.p+L.v));
        return 1;
    }

    double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d= L.p.y - cir.c.y;
    double e = a*a+c*c, f = 2*(a*b + c*d), g = b*b+d*d-cir.r*cir.r;
    double delta = f*f - 4*e*g;
    if (dcmp(delta)<0) return 0;
    else if (dcmp(delta)==0) {
        t1 = t2 = -f / (2*e); sol.pb(L.point(t1));
        return 1;
    }
    t1 = (-f - sqrt(delta)) / (2*e); sol.pb(L.point(t1));
    t2 = (-f + sqrt(delta)) / (2*e); sol.pb(L.point(t2));
    return 2;
}
double angle(V v) {return atan2(v.y,v.x);}
int getCircleCircleIntersection(C C1,C C2,vector<P>& sol) {
    double d = Length(C1.c-C2.c);
    if (dcmp(d)==0) {
        if (dcmp(C1.r - C2.r)==0) return -1; //2圆重合
        return 0;
    }
    if (dcmp(C1.r+C2.r-d)<0) return 0;
    if (dcmp(fabs(C1.r-C2.r)-d)>0) return 0;

    double a = angle(C2.c-C1.c);
    double da = acos((C1.r*C1.r+d*d - C2.r*C2.r)/ (2*C1.r*d));
    P p1 = C1.point(a-da), p2 = C1.point(a+da);
    sol.pb(p1);
    if (p1==p2) return 1;
    sol.pb(p2);
    return 2;
}
// Tangents-切线
int getTangents(P p,C c,V* v) {
    V u= c.c-p;
    double dist = Length(u);
    if (dist<c.r) return 0;
    else if (dcmp(dist-c.r)==0) {
        v[0]=Rotate(u,PI/2);
        return 1;
    } else {
        double ang = asin(c.r / dist);
        v[0]=Rotate(u,-ang);
        v[1]=Rotate(u,ang);
        return 2;
    }
}
//这个函数假设整数坐标和整数半径
//double时要把int改成double
int getTangents(C A,C B,P* a,P* b) {
    int cnt=0;
    if (A.r<B.r) {swap(A,B),swap(a,b);}
    int d2 = (A.c.x-B.c.x)*(A.c.x-B.c.x) + (A.c.y-B.c.y)*(A.c.y-B.c.y);
    int rdiff = A.r-B.r;
    int rsum = A.r+B.r;
    if (d2<rdiff*rdiff) return 0;
    double base = atan2(B.y-A.y,B.x-A.x);
    if (d2==0 && A.r == B.r) return -1;
    if (d2 == rdiff*rdiff) {
        a[cnt] = A.point(base); b[cnt] = B.point(base); ++cnt;
        return 1;
    }
    double ang = acos((A.r-B.r)/sqrt(d2));
    a[cnt] = A.point(base+ang); b[cnt] = B.point(base+ang); ++cnt;
    a[cnt] = A.point(base-ang); b[cnt] = B.point(base-ang); ++cnt;
    if (d2==rsum*rsum) {
        a[cnt] = A.point(base); b[cnt] = B.point(PI+base); ++cnt;
    }
    else if (d2>rsum*rsum) {
        double ang = acos((A.r+B.r)/sqrt(d2));
        a[cnt] = A.point(base+ang); b[cnt] = B.point(PI+base+ang); ++cnt;
        a[cnt] = A.point(base-ang); b[cnt] = B.point(PI+base-ang); ++cnt;
    }
    return cnt;
}
//Circumscribed-外接
C CircumscribedCircle(P p1,P p2,P p3) {
    double Bx = p2.x-p1.x, By= p2.y-p1.y;
    double Cx = p3.x-p1.x, Cy= p3.y-p1.y;
    double D = 2*(Bx*Cy-By*Cx);
    double cx = (Cy*(Bx*Bx+By*By)-By*(Cx*Cx+Cy*Cy))/D + p1.x;
    double cy = (Bx*(Cx*Cx+Cy*Cy)-Cx*(Bx*Bx+By*By))/D + p1.y;
    P p =P(cx,cy);
    return C(p,Length(p1-p));
}
//Inscribed-内接
C InscribedCircle(P p1,P p2,P p3) {
    double a = Length(p2-p3);
    double b = Length(p3-p1);
    double c = Length(p1-p2);
    P p = (p1*a+p2*b+p3*c)/(a+b+c);
    return C(p,DistanceToLine(p,p1,p2));
}
double torad(double deg) {
    return deg/180*acos(-1);
}
//把 角度+-pi 转换到 [0,pi) 上
double radToPositive(double rad) {
    if (dcmp(rad)<0) rad=ceil(-rad/PI)*PI+rad;
    if (dcmp(rad-PI)>=0) rad-=floor(rad/PI)*PI;
    return rad;
}
double todeg(double rad) {
    return rad*180/acos(-1);
}

//(R,lat,lng)->(x,y,z)
void get_coord(double R,double lat,double lng,double &x,double &y,double &z) {
    lat=torad(lat);
    lng=torad(lng);
    x=R*cos(lat)*cos(lng);
    y=R*cos(lat)*sin(lng);
    z=R*sin(lat);
}
void print(double a) {
    printf("%.6lf",a);
}
void print(P p) {
    printf("(%.6lf,%.6lf)",p.x,p.y);
}
template<class T>
void print(vector<T> v) {
    sort(v.begin(),v.end());
    putchar(‘[‘);
    int n=v.size();
    Rep(i,n) {
        print(v[i]);
        if (i<n-1) putchar(‘,‘);
    }
    puts("]");
}
// 把直线沿v平移
// Translation-平移
Line LineTranslation(Line l,V v) {
    l.p=l.p+v;
    return l;
}
void CircleThroughAPointAndTangentToALineWithRadius(P p,Line l,double r,vector<P>& sol) {
    V e=Normal(l.v);
    Line l1=LineTranslation(l,e*r),l2=LineTranslation(l,e*(-r));
    double t1,t2;
    getLineCircleIntersection(l1,C(p,r),t1,t2,sol);
    getLineCircleIntersection(l2,C(p,r),t1,t2,sol);
}
void CircleTangentToTwoLinesWithRadius(Line l1,Line l2,double r,vector<P>& sol) {
    V e1=Normal(l1.v),e2=Normal(l2.v);
    Line L1[2]={LineTranslation(l1,e1*r),LineTranslation(l1,e1*(-r))},
         L2[2]={LineTranslation(l2,e2*r),LineTranslation(l2,e2*(-r))};
    Rep(i,2) Rep(j,2) sol.pb(GetLineIntersection(L1[i].p,L1[i].v,L2[j].p,L2[j].v));
}
void CircleTangentToTwoDisjointCirclesWithRadius(C c1,C c2,double r,vector<P>& sol) {
    c1.r+=r; c2.r+=r;
    getCircleCircleIntersection(c1,c2,sol);
}

P p[4];
bool ConvexPolygon(P &A,P &B,P &C,P &D) {
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    swap(B,C);
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    swap(D,C);
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    return 0;
}
bool IsParallel(P A,P B,P C,P D) {
    return dcmp(Cross(B-A,D-C))==0;
}
bool IsPerpendicular(V A,V B) {
    return dcmp(Dot(A,B))==0;
}
//先调用ConvexPolygon 求凸包并确认是否是四边形
// Trapezium-梯形 Rhombus-菱形
bool IsTrapezium(P A,P B,P C,P D){
    return IsParallel(A,B,C,D)^IsParallel(B,C,A,D);
}
bool IsParallelogram(P A,P B,P C,P D) {
    return IsParallel(A,B,C,D)&&IsParallel(B,C,A,D);
}
bool IsRhombus(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&dcmp(Length(B-A)-Length(C-B))==0;
}
bool IsRectangle(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A);
}
bool IsSquare(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A)&&dcmp(Length(B-A)-Length(C-B))==0;
}

int main()
{
//  freopen("uva11800.in","r",stdin);
//  freopen(".out","w",stdout);
    int T=read();
    For(kcase,T) {
        Rep(i,4) p[i]=read_point();

        cout<<"Case "<<kcase<<": ";
        if (!ConvexPolygon(p[0],p[1],p[2],p[3])) puts("Ordinary Quadrilateral");
        else {
            P A=p[0],B=p[1],C=p[2],D=p[3];
            if (IsSquare(A,B,C,D)) puts("Square");
            else if (IsRectangle(A,B,C,D)) puts("Rectangle");
            else if (IsRhombus(A,B,C,D)) puts("Rhombus");
            else if (IsParallelogram(A,B,C,D)) puts("Parallelogram");
            else if (IsTrapezium(A,B,C,D)) puts("Trapezium");
            else puts("Ordinary Quadrilateral");

        }
    }

    return 0;
}

UVA 11646 Athletics Track

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
int main()
{
//  freopen("uva11646.in","r",stdin);
//  freopen(".out","w",stdout);
    double a,b;
    int kcase=1;
    while(scanf("%lf : %lf\n",&a,&b)!=EOF) {
        double r=sqrt(a*a+b*b)/2;
        double xita=asin(b/2.0/r)*2;
        double rxita=r*xita;
        double x=200.0/(a +rxita);
        printf("Case %d: %.10lf %.10lf\n",kcase++,a*x,b*x);
    }

    return 0;
}

UVA 11817 Tunnelling the Earth 球面距离

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
ll sqr(ll a){return a*a;}
ld sqr(ld a){return a*a;}
double sqr(double a){return a*a;}

ld PI = 3.141592653589793238462643383;
class P{
public:
    double x,y;
    P(double x=0,double y=0):x(x),y(y){}
    friend long double dis2(P A,P B){return sqr(A.x-B.x)+sqr(A.y-B.y);  }
    friend long double Dot(P A,P B) {return A.x*B.x+A.y*B.y; }
    friend long double Length(P A) {return sqrt(Dot(A,A)); }
    friend long double Angle(P A,P B) {return acos(Dot(A,B) / Length(A) / Length(B) ); }

    friend P operator- (P A,P B) { return P(A.x-B.x,A.y-B.y); }
    friend P operator+ (P A,P B) { return P(A.x+B.x,A.y+B.y); }
    friend P operator* (P A,double p) { return P(A.x*p,A.y*p); }
    friend P operator/ (P A,double p) { return P(A.x/p,A.y/p); }
    friend bool operator< (const P& a,const P& b) {return a.x<b.x||(a.x==b.x&& a.y<b.y);}

};
const double eps=1e-10;
int dcmp(double x) {
    if (fabs(x)<eps) return 0; else return x<0 ? -1 : 1;
}
bool operator==(const P& a,const P& b) {
    return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y) == 0;
}
typedef P V;

double Cross(V A,V B) {return A.x*B.y - A.y*B.x;}
double Area2(P A,P B,P C) {return Cross(B-A,C-A);}
V Rotate(V A,double rad) {
    return V(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
}
// A 不是 0向量
V Normal(V A) {
    double L = Length(A);
    return V(-A.y/L , A.x/L);
}

namespace complex_G{
    typedef complex<double> Point;
    //real(p):实部 imag(p):虚部 conj(p):共轭
    typedef Point Vector;
    double Dot(Vector A,Vector B) {return real(conj(A)*B); }
    double Cross(Vector A,Vector B) {return imag(conj(A)*B); }
    Vector Rotate(Vector A,double rad) {return A*exp(Point(0,rad)); }
}
//Cross(v,w)==0(平行)时,不能调这个函数
P GetLineIntersection(P p,V v,P Q,V w){
    V u = p-Q;
    double t = Cross(w,u)/Cross(v,w);
    return p+v*t;
}
P GetLineIntersectionB(P p,V v,P Q,V w){
    return GetLineIntersection(p,v-p,Q,w-Q);
}

double DistanceToLine(P p,P A,P B) {
    V v1 = B-A, v2 = p-A;
    return fabs(Cross(v1,v2))/Length(v1);
}
double DistanceToSegment(P p,P A,P B) {
    if (A==B) return Length(p-A);
    V v1 = B-A, v2 = p-A, v3 = p - B;
    if (dcmp(Dot(v1,v2))<0) return Length(v2);
    else if (dcmp(Dot(v1,v3))>0 ) return Length(v3);
    else return fabs(Cross(v1,v2) ) / Length(v1);
}
P GetLineProjection(P p,P A,P B) {
    V v=B-A;
    return A+v*(Dot(v,p-A)/Dot(v,v));
}
//规范相交-线段相交且交点不在端点
bool SegmentProperIntersection(P a1,P a2,P b1,P b2) {
    double  c1 = Cross(a2-a1,b1-a1) , c2 = Cross(a2-a1,b2-a1),
            c3 = Cross(b2-b1,a1-b1) , c4 = Cross(b2-b1,a2-b1);
    return dcmp(c1)*dcmp(c2)<0 && dcmp(c3)*dcmp(c4)<0;
}
//点在线段上(不包含端点)
bool OnSegment(P p,P a1,P a2) {
    return dcmp(Cross(a1-p,a2-p)) == 0 && dcmp(Dot(a1-p,a2-p))<0;
}
double PolygonArea(P *p,int n) {
    double area=0;
    For(i,n-2) area+=Cross(p[i]-p[0],p[i+1]-p[0]);
    return area/2;
}
/*欧拉公式: V+F-E=2
V-点数 F面数 E边数 */
P read_point() {
    P a;
    scanf("%lf%lf",&a.x,&a.y);
    return a;
}
struct C{
    P c;
    double r,x,y;
    C(P c,double r):c(c),r(r),x(c.x),y(c.y){}
    P point(double a) {
        return P(c.x+cos(a)*r,c.y+sin(a)*r);
    }
};

struct Line{
    P p;
    V v;
    double ang;
    Line(){}
    Line(P p,V v):p(p),v(v) {ang=atan2(v.y,v.x); }
    bool operator<(const Line & L) const {
        return ang<L.ang;
    }
    P point(double a) {
        return p+v*a;
    }
};
int getLineCircleIntersection(Line L,C cir,double &t1,double &t2,vector<P> & sol) {
    if (dcmp(DistanceToLine(cir.c,L.p,L.p+L.v)-cir.r)==0) {
        sol.pb(GetLineProjection(cir.c,L.p,L.p+L.v));
        return 1;
    }

    double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d= L.p.y - cir.c.y;
    double e = a*a+c*c, f = 2*(a*b + c*d), g = b*b+d*d-cir.r*cir.r;
    double delta = f*f - 4*e*g;
    if (dcmp(delta)<0) return 0;
    else if (dcmp(delta)==0) {
        t1 = t2 = -f / (2*e); sol.pb(L.point(t1));
        return 1;
    }
    t1 = (-f - sqrt(delta)) / (2*e); sol.pb(L.point(t1));
    t2 = (-f + sqrt(delta)) / (2*e); sol.pb(L.point(t2));
    return 2;
}
double angle(V v) {return atan2(v.y,v.x);}
int getCircleCircleIntersection(C C1,C C2,vector<P>& sol) {
    double d = Length(C1.c-C2.c);
    if (dcmp(d)==0) {
        if (dcmp(C1.r - C2.r)==0) return -1; //2圆重合
        return 0;
    }
    if (dcmp(C1.r+C2.r-d)<0) return 0;
    if (dcmp(fabs(C1.r-C2.r)-d)>0) return 0;

    double a = angle(C2.c-C1.c);
    double da = acos((C1.r*C1.r+d*d - C2.r*C2.r)/ (2*C1.r*d));
    P p1 = C1.point(a-da), p2 = C1.point(a+da);
    sol.pb(p1);
    if (p1==p2) return 1;
    sol.pb(p2);
    return 2;
}
// Tangents-切线
int getTangents(P p,C c,V* v) {
    V u= c.c-p;
    double dist = Length(u);
    if (dist<c.r) return 0;
    else if (dcmp(dist-c.r)==0) {
        v[0]=Rotate(u,PI/2);
        return 1;
    } else {
        double ang = asin(c.r / dist);
        v[0]=Rotate(u,-ang);
        v[1]=Rotate(u,ang);
        return 2;
    }
}
//这个函数假设整数坐标和整数半径
//double时要把int改成double
int getTangents(C A,C B,P* a,P* b) {
    int cnt=0;
    if (A.r<B.r) {swap(A,B),swap(a,b);}
    int d2 = (A.c.x-B.c.x)*(A.c.x-B.c.x) + (A.c.y-B.c.y)*(A.c.y-B.c.y);
    int rdiff = A.r-B.r;
    int rsum = A.r+B.r;
    if (d2<rdiff*rdiff) return 0;
    double base = atan2(B.y-A.y,B.x-A.x);
    if (d2==0 && A.r == B.r) return -1;
    if (d2 == rdiff*rdiff) {
        a[cnt] = A.point(base); b[cnt] = B.point(base); ++cnt;
        return 1;
    }
    double ang = acos((A.r-B.r)/sqrt(d2));
    a[cnt] = A.point(base+ang); b[cnt] = B.point(base+ang); ++cnt;
    a[cnt] = A.point(base-ang); b[cnt] = B.point(base-ang); ++cnt;
    if (d2==rsum*rsum) {
        a[cnt] = A.point(base); b[cnt] = B.point(PI+base); ++cnt;
    }
    else if (d2>rsum*rsum) {
        double ang = acos((A.r+B.r)/sqrt(d2));
        a[cnt] = A.point(base+ang); b[cnt] = B.point(PI+base+ang); ++cnt;
        a[cnt] = A.point(base-ang); b[cnt] = B.point(PI+base-ang); ++cnt;
    }
    return cnt;
}
//Circumscribed-外接
C CircumscribedCircle(P p1,P p2,P p3) {
    double Bx = p2.x-p1.x, By= p2.y-p1.y;
    double Cx = p3.x-p1.x, Cy= p3.y-p1.y;
    double D = 2*(Bx*Cy-By*Cx);
    double cx = (Cy*(Bx*Bx+By*By)-By*(Cx*Cx+Cy*Cy))/D + p1.x;
    double cy = (Bx*(Cx*Cx+Cy*Cy)-Cx*(Bx*Bx+By*By))/D + p1.y;
    P p =P(cx,cy);
    return C(p,Length(p1-p));
}
//Inscribed-内接
C InscribedCircle(P p1,P p2,P p3) {
    double a = Length(p2-p3);
    double b = Length(p3-p1);
    double c = Length(p1-p2);
    P p = (p1*a+p2*b+p3*c)/(a+b+c);
    return C(p,DistanceToLine(p,p1,p2));
}
double torad(double deg) {
    return deg/180*acos(-1);
}
//把 角度+-pi 转换到 [0,pi) 上
double radToPositive(double rad) {
    if (dcmp(rad)<0) rad=ceil(-rad/PI)*PI+rad;
    if (dcmp(rad-PI)>=0) rad-=floor(rad/PI)*PI;
    return rad;
}
double todeg(double rad) {
    return rad*180/acos(-1);
}

//(R,lat,lng)->(x,y,z)
void get_coord(double R,double lat,double lng,double &x,double &y,double &z) {
    lat=torad(lat);
    lng=torad(lng);
    x=R*cos(lat)*cos(lng);
    y=R*cos(lat)*sin(lng);
    z=R*sin(lat);
}
void print(double a) {
    printf("%.6lf",a);
}
void print(P p) {
    printf("(%.6lf,%.6lf)",p.x,p.y);
}
template<class T>
void print(vector<T> v) {
    sort(v.begin(),v.end());
    putchar(‘[‘);
    int n=v.size();
    Rep(i,n) {
        print(v[i]);
        if (i<n-1) putchar(‘,‘);
    }
    puts("]");
}
// 把直线沿v平移
// Translation-平移
Line LineTranslation(Line l,V v) {
    l.p=l.p+v;
    return l;
}
void CircleThroughAPointAndTangentToALineWithRadius(P p,Line l,double r,vector<P>& sol) {
    V e=Normal(l.v);
    Line l1=LineTranslation(l,e*r),l2=LineTranslation(l,e*(-r));
    double t1,t2;
    getLineCircleIntersection(l1,C(p,r),t1,t2,sol);
    getLineCircleIntersection(l2,C(p,r),t1,t2,sol);
}
void CircleTangentToTwoLinesWithRadius(Line l1,Line l2,double r,vector<P>& sol) {
    V e1=Normal(l1.v),e2=Normal(l2.v);
    Line L1[2]={LineTranslation(l1,e1*r),LineTranslation(l1,e1*(-r))},
         L2[2]={LineTranslation(l2,e2*r),LineTranslation(l2,e2*(-r))};
    Rep(i,2) Rep(j,2) sol.pb(GetLineIntersection(L1[i].p,L1[i].v,L2[j].p,L2[j].v));
}
void CircleTangentToTwoDisjointCirclesWithRadius(C c1,C c2,double r,vector<P>& sol) {
    c1.r+=r; c2.r+=r;
    getCircleCircleIntersection(c1,c2,sol);
}
//确定4个点能否组成凸多边形,并按顺序(不一定是逆时针)返回
bool ConvexPolygon(P &A,P &B,P &C,P &D) {
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    swap(B,C);
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    swap(D,C);
    if (SegmentProperIntersection(A,C,B,D)) return 1;
    return 0;
}
bool IsParallel(P A,P B,P C,P D) {
    return dcmp(Cross(B-A,D-C))==0;
}
bool IsPerpendicular(V A,V B) {
    return dcmp(Dot(A,B))==0;
}
//先调用ConvexPolygon 求凸包并确认是否是四边形
// Trapezium-梯形 Rhombus-菱形
bool IsTrapezium(P A,P B,P C,P D){
    return IsParallel(A,B,C,D)^IsParallel(B,C,A,D);
}
bool IsParallelogram(P A,P B,P C,P D) {
    return IsParallel(A,B,C,D)&&IsParallel(B,C,A,D);
}
bool IsRhombus(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&dcmp(Length(B-A)-Length(C-B))==0;
}
bool IsRectangle(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A);
}
bool IsSquare(P A,P B,P C,P D) {
    return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A)&&dcmp(Length(B-A)-Length(C-B))==0;
}
//chord-弦 arc-弧
double ArcDis(double chord,double r) {
    return 2*asin(chord/2/r)*r;
}
int main()
{
//  freopen("uva11817.in","r",stdin);
//  freopen(".out","w",stdout);
    double a,b;
    int T=read();
    const double r=6371009;
    double lat,lng,lat2,lng2;
    while(scanf("%lf%lf%lf%lf",&lat,&lng,&lat2,&lng2)!=EOF) {

        double x,y,z,x2,y2,z2;
        get_coord(r,lat,lng,x,y,z);
        get_coord(r,lat2,lng2,x2,y2,z2);
        double chord=sqrt(sqr(x-x2)+sqr(y-y2)+sqr(z-z2));
        double ans=round(ArcDis(chord,r)-chord);
        printf("%0.lf\n",ans);
    }

    return 0;
}

UVA 1473 Dome of Circus

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
const int MAXN = 10000+10;
int n;
double r[MAXN],z[MAXN];
double getR(double H) {
    double R=0;
    Rep(i,n) R=max(R,z[i]*r[i]/(H-z[i])+r[i]);
    return R;
}
int main()
{
//  freopen("uva1473.in","r",stdin);
//  freopen(".out","w",stdout);

    while(cin>>n) {
        Rep(i,n) {
            double x,y;
            cin>>x>>y>>z[i];
            r[i]=sqrt(x*x+y*y);
        }
        double L=0,R=1e9;
        Rep(i,n) L=max(L,z[i]);
        while(R-L>1e-9) {
            double m1=L+(R-L)/3;
            double m2=R-(R-L)/3;
            double r1=getR(m1),r2=getR(m2);
            if (r1*r1*m1<r2*r2*m2) R=m2; else L=m1;
        }
        cout<<setiosflags(ios::fixed)<<setprecision(3);
        cout<<L<<‘ ‘<<getR(L)<<endl;
    }

    return 0;
}

UVA 11524 InCircle

内切圆面积公式S=(a+b+c)r2

海伦公式S=p(p?a)(p?b)(p?c)?????????????????√,p=(a+b+c)/2

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
int main()
{
//  freopen("uva11524.in","r",stdin);
//  freopen(".out","w",stdout);

    const double eps=1e-5;
    int T=read();
    while(T--) {
        double r,m1,n1,m2,n2,m3,n3;
        cin>>r>>m1>>n1>>m2>>n2>>m3>>n3;
        double a=1.0;
        double b=1./(m1+n1)*m1/n3*(m3+n3);
        double c=1./(m1+n1)*n1/m2*(m2+n2);
        double S=r*(a+b+c)/2;
        double p=(a+b+c)/2;
        double S2=sqrt(p*(p-a)*(p-b)*(p-c));
        double k=S2/S;
        cout<<setiosflags(ios::fixed)<<setprecision(4);
        cout<<S/k<<endl;
    }

    return 0;
}

UVA 11731 Ex-circles 旁切圆

旁切圆半径:2S△?a+b+c

旁切圆座标:Ja=(?ax1+bx2+cx3?a+b+c,?ay1+by2+cy3?a+b+c)

盘切圆圆心角:∠A旁切=π/2?∠C

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
double angle(double a,double b,double c) {
    return acos((a*a+b*b-c*c)/2/a/b);
}
double S;
double getR(double a,double b,double c) {
    return 2*S/(-a+b+c);
}
double PI=acos(-1);
int main()
{
//  freopen("uva11731.in","r",stdin);
//  freopen(".out","w",stdout);

    int a,b,c,kcase=1;
    while(cin>>a>>b>>c&&a) {
        double p=(a+b+c)/2.0;
        S=sqrt(p*(p-a)*(p-b)*(p-c));
        double r1=getR(a,b,c),r2=getR(b,c,a),r3=getR(c,a,b);
        double ans1=S+(a*r1+b*r2+c*r3)/2;
        double ans2=(PI-angle(b,c,a))/2*r1*r1
                    +(PI-angle(a,c,b))/2*r2*r2
                    +(PI-angle(a,b,c))/2*r3*r3;
        ans2/=2;
        printf("Case %d: %.2f %.2f\n",kcase++,ans1,ans2);
    }

    return 0;
}

UVA 12300 Smallest Regular Polygon

根据外接圆半径算

贪心:对角线中最长的。

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
double PI = acos(-1);
int main()
{
//  freopen("uva12300.in","r",stdin);
//  freopen(".out","w",stdout);
    double a,b,c,d;
    int n;
    while(cin>>a>>b>>c>>d>>n&&n) {
        double dis=sqrt((c-a)*(c-a)+(b-d)*(b-d));

        double xita=2*PI/n,r;
        if (n%2==0) {
            r=dis/2;
        } else {
            double phi = PI-xita/2;
            r=sqrt(dis*dis/2/(1-cos(phi)));
        }
        double S=r*r*sin(xita)*n/2;
        printf("%.6lf\n",S);
    }

    return 0;
}

UVA 10566 Crossed Ladders

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
int main()
{
//  freopen("uva10566.in","r",stdin);
//  freopen(".out","w",stdout);

    double x,y,c;
    while(cin>>x>>y>>c) {
        double L=0,R=min(x,y);
        while(R-L>=1e-9) {
            double m=(L+R)/2;
            double p=1/sqrt(x*x-m*m)+1/sqrt(y*y-m*m)-1/c;
            if (p<0) L=m; else R=m;
        }
        printf("%.3lf\n",L);

    }

    return 0;
}

UVA 11186 Circum Triangle

S△abc=S△Oab+S△Obc?S△Oac

考虑每个有一个点在圆心的三角形出现的次数,容斥

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
double rad[1000];
int main()
{
//  freopen("uva11186.in","r",stdin);
//  freopen(".out","w",stdout);
    int n,r;
    while(cin>>n>>r&&n) {
        Rep(i,n) {
            cin>>rad[i];
            rad[i]=rad[i]/180*acos(-1);
        }
        sort(rad,rad+n);
        double ans=0;
        Rep(i,n) Fork(j,i+1,n-1) ans+=(double)(n+2*i-2*j)*sin(rad[j]-rad[i]);
        ans*=r*r/2;
        printf("%.0lf\n",ans);

    }

    return 0;
}

UVA 12165 Triangle Hazard

梅涅劳斯定理:如果一条直线与△ABC的三边AB、BC、CA或其延长线交于F、D、E点,那么(AF/FB)×(BD/DC)×(CE/EA)=1。

对题目中

△ABD,FC 与 △ACD,BE 用定理,联立解出AR/RP

#include<bits/stdc++.h>
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=Pre[x];p;p=Next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=Next[p])
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,127,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define INF (2139062143)
#define F (100000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<‘ ‘; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
                        For(j,m-1) cout<<a[i][j]<<‘ ‘;                        cout<<a[i][m]<<endl;                         }
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return (a-b+llabs(a-b)/F*F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
int read()
{
    int x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) {if (ch==‘-‘) f=-1; ch=getchar();}
    while(isdigit(ch)) { x=x*10+ch-‘0‘; ch=getchar();}
    return x*f;
}
ll sqr(ll a){return a*a;}
ld sqr(ld a){return a*a;}
double sqr(double a){return a*a;}

ld PI = 3.141592653589793238462643383;
class P{
public:
    double x,y;
    P(double x=0,double y=0):x(x),y(y){}
    friend long double dis2(P A,P B){return sqr(A.x-B.x)+sqr(A.y-B.y);  }
    friend long double Dot(P A,P B) {return A.x*B.x+A.y*B.y; }
    friend long double Length(P A) {return sqrt(Dot(A,A)); }
    friend long double Angle(P A,P B) {return acos(Dot(A,B) / Length(A) / Length(B) ); }

    friend P operator- (P A,P B) { return P(A.x-B.x,A.y-B.y); }
    friend P operator+ (P A,P B) { return P(A.x+B.x,A.y+B.y); }
    friend P operator* (P A,double p) { return P(A.x*p,A.y*p); }
    friend P operator/ (P A,double p) { return P(A.x/p,A.y/p); }
    friend bool operator< (const P& a,const P& b) {return a.x<b.x||(a.x==b.x&& a.y<b.y);}

};

P read_point() {
    P a;
    scanf("%lf%lf",&a.x,&a.y);
    return a;
}
P getA(P p,P r,double m1,double m2,double m3,double m4,double m5,double m6) {
    double dr_ra=1/(m5/m6*(m1+m2)/m2);
    double dp_pa=1/(m4/m3*(m1+m2)/m1);
    double ra_da=1/(dr_ra+1);
    double pa_da=1/(dp_pa+1);
    double pr_da=pa_da-ra_da;
    double ra_pr=ra_da/pr_da;
    double pr=Length(p-r);
    double ra=pr*ra_pr;
    return r+(r-p)*ra_pr;
}
int main()
{
//  freopen("uva12165.in","r",stdin);
//  freopen(".out","w",stdout);
    int T=read();
    while(T--) {
        P p=read_point(),q=read_point(),r=read_point();
        double m[7];
        For(i,6) cin>>m[i];
        P A=getA(p,r,m[1],m[2],m[3],m[4],m[5],m[6]),
          C=getA(r,q,m[5],m[6],m[1],m[2],m[3],m[4]),
          B=getA(q,p,m[3],m[4],m[5],m[6],m[1],m[2]);
        printf("%.8lf %.8lf %.8lf %.8lf %.8lf %.8lf\n",A.x,A.y,B.x,B.y,C.x,C.y);
    }

    return 0;
}
时间: 2024-10-02 21:46:41

几何基础专题的相关文章

【kuangbin专题】计算几何基础(极角相关)

[POJ 1696] Space Ants [题目大意] 给定多个点,对他们按照下面的规则排序,每个都在前一个点组成的左边,并且连线不相交(典型如图) [题目分析] 不断进行极角排序,不断选取一定区域内最符合要求的解 [代码] 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #define ll double 5 using namespace std; 6 const double eps

【团购巨划算】韩立刚老师门徒级学习专题,只此一次的超大优惠福利

Q:韩立刚老师是谁? A:韩老师是51CTO金牌讲师(最高级别),也是微软最有价值专家MVP.微软企业护航专家.<计算机网络原理>一书作者 讲师主页:http://edu.51cto.com/lecturer/400469.html Q:门徒级学习专题是什么? A:韩立刚老师门徒级课程专题(Windows Server+网络安全+数据库) 韩老师从2013年至今,根据企业对IT运维人才的技术要求,录制视频教程49 门,时长达581小时50分钟.旨在从0起点培养企业高端IT人才,让你在企业IT部

c指针-专题

六---指针 内存和地址怎么理解呢? 机器中有一些位置,每一个位置被称为[字节]/byte,许多现代机器上,每个字节包含8个位.更大内存单位[字],通常包含2个或4个字节组成. 一个字包含4个字节,它的地址是什么? 他仍然只有一个地址,是最左边还是最右边的那个字节的位置,取决于机器. 机器事实-关于整型的起始位置: 在要求边界对齐(boundaryalignment)的机器上,整型存储的起始位置只能是某些特定的字节,通常是2或4的倍数. 变量名和地址关系? 所有高级语言的特性之一,就是通过名字而

无线安全专题_破解篇03--打造个人字典

上一篇讲解了如何通过Kali破解Pin码,今天继续无线安全专题破解篇的第三讲:打造个人字典.通过第一课,我们知道想要破解WPA加密,需要一个强大的字典.字典的强大直接决定了破解的可能性,废话不多说,咱们就学习一下怎么使用kali中的工具生打造个人字典.  一.crunsh工具介绍 今天主要说的是crunsh这款工具,专门用来生成字典. 命令参数: -b              #体积大小,比如-b 20mib 或者 -b 20kib -c              #密码个数(行数),比如80

最短路径算法专题1----弗洛伊德

由于最短路径算法我认为比较重要,所以分成几个专题来慢慢细化去磨它,不能一口气吃个胖子嘛. 首先在说算法之前,先说清楚什么叫做最短路径. 题目一般会给你一张图,然后告诉你很多地方,然后告诉你各个地方之间的路程有多远,要你求出,两点间的最短距离,注意,题目给出的两点间的距离未必是最短的,可能通过第三个点转换之后达到更短.实际其实也是这样的,有时候两个地方并没有直线的道路只有曲线的绕路. 算法的思路: 1.用二维数组列出所有的距离,达到不了的用最大距离表示,如9999999 2.循环数组上面的每一个点

Cocos3D专题课程源码地址

源码地址 https://github.com/super626/LessonDemo cocos2d引擎版本3.7以上 下载后放置在LessonDemo/cocos2d目录下 MAC配置文件 LessonDemo/proj.ios_mac/LessonDemo.xcodeproj,直接用Xcode打开(Xcode5.1以上).编译桌面版和iOS版. win32配置文件 LessonDemo/proj.win32/LessonDemo.sln,用Visual Studio 2012以上版本打开,

Android基础入门教程——10.12 传感器专题(3)——加速度-陀螺仪传感器

Android基础入门教程--10.12 传感器专题(3)--加速度/陀螺仪传感器 标签(空格分隔): Android基础入门教程 本节引言: 本节继续来扣Android中的传感器,本节带来的是加速度传感器(Accelerometer sensor)以及 陀螺仪传感器(Gyroscope sensor),和上一节的方向传感器一样有着x,y,z 三个轴, 还是要说一点:x,y轴的坐标要和绘图那里的x,y轴区分开来!传感器的是以左下角 为原点的!x向右,y向上!好的,带着我们的套路来学本节的传感器吧

KMP专题总结

KMP算法有两种计算失配函数的方法 未优化过的失配函数 , f[i] 就表示 str[0~i-1] 的公共最长前后缀( 不包括str[0~i-1]本身,比如aaa的最长公共前后缀长度为2 ) , 这个特性必须牢记 从下面的例子应该也可以看出 0  1  2  3  4  5  6  7  8  9  10 str  a  a  a  a  b  b  a  a  b  a  '\0' f   0  0  1  2  3  0  0  1  2  0   1 优化过后的失配函数,虽然匹配的性能要好

2014世界杯楼市专题网页设计欣赏

四年一次的世界杯开赛了,看球场上下尽风流,帅气.搞笑.疯狂.养眼,小编在这里为你整理了一些不一样的世界杯专题网页设计,为你呈现一个不一样的视觉体验,下面来一起欣赏一下吧. 特别设计过的主题文字组合,呼应世界杯的狂欢主题,配图世界杯主题色配色,大面积的黄色加上绿色搭配,淡色的世界杯相关物品,起到了非常好的气氛渲染效果. 硬气的文字设计,漂亮的文字排版,与动态的球员相呼应的倾斜版式,加上动感的配图造型,加上有活力的配色,让整个画面颇具动感. 选图很有张力,场景模拟加虚实处理交互性很强的JS特效,让人