(迷惑发言)
点开发现是个傻逼题,一个小时就施展完了。
题意很简单,在y轴上有一些球,让你求它们的表面积。
一看就直接考虑每个球的贡献吧,
维护一下其他球对这个球造成的影响,然后这个球的贡献就会在[down,up]里,分几种情况求就行了。
不想多分的话可以直接对0取max,比方说down>up这样子。
这队友没板子手写一直wa看得我好心疼啊。
不过圆交手写起来也不难吧。。。(超小声)

#include <bits/stdc++.h>
using namespace std;
typedef double db;
const db eps=1e-6;
const db pi=acos(-1);
int sign(db k){
    if (k>eps) return 1; else if (k<-eps) return -1; return 0;
}
int cmp(db k1,db k2){return sign(k1-k2);}
int inmid(db k1,db k2,db k3){return sign(k1-k3)*sign(k2-k3)<=0;}// k3 在 [k1,k2] 内
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);}
};
int inmid(point k1,point k2,point k3){return inmid(k1.x,k2.x,k3.x)&&inmid(k1.y,k2.y,k3.y);}
db cross(point k1,point k2){return k1.x*k2.y-k1.y*k2.x;}
db dot(point k1,point k2){return k1.x*k2.x+k1.y*k2.y;}
db rad(point k1,point k2){return atan2(cross(k1,k2),dot(k1,k2));}
// -pi -> pi
int compareangle (point k1,point k2){//极角排序+
    return k1.getP()<k2.getP()||(k1.getP()==k2.getP()&&sign(cross(k1,k2))>0);
}
point proj(point k1,point k2,point q){ // q 到直线 k1,k2 的投影
    point k=k2-k1;return k1+k*(dot(q-k1,k)/k.abs2());
}
point reflect(point k1,point k2,point q){return proj(k1,k2,q)*2-q;}
int clockwise(point k1,point k2,point k3){// k1 k2 k3 逆时针 1 顺时针 -1 否则 0
    return sign(cross(k2-k1,k3-k1));
}
int checkLL(point k1,point k2,point k3,point k4){// 求直线 (L) 线段 (S)k1,k2 和 k3,k4 的交点
    return cmp(cross(k3-k1,k4-k1),cross(k3-k2,k4-k2))!=0;
}
point getLL(point k1,point k2,point k3,point k4){
    db w1=cross(k1-k3,k4-k3),w2=cross(k4-k3,k2-k3); return (k1*w2+k2*w1)/(w1+w2);
}
int intersect(db l1,db r1,db l2,db r2){
    if (l1>r1) swap(l1,r1); if (l2>r2) swap(l2,r2); return cmp(r1,l2)!=-1&&cmp(r2,l1)!=-1;
}
int checkSS(point k1,point k2,point k3,point k4){
    return intersect(k1.x,k2.x,k3.x,k4.x)&&intersect(k1.y,k2.y,k3.y,k4.y)&&
           sign(cross(k3-k1,k4-k1))*sign(cross(k3-k2,k4-k2))<=0&&
           sign(cross(k1-k3,k2-k3))*sign(cross(k1-k4,k2-k4))<=0;
}
db disSP(point k1,point k2,point q){
    point k3=proj(k1,k2,q);
    if (inmid(k1,k2,k3)) return q.dis(k3); else return min(q.dis(k1),q.dis(k2));
}
db disSS(point k1,point k2,point k3,point k4){
    if (checkSS(k1,k2,k3,k4)) return 0;
    else return min(min(disSP(k1,k2,k3),disSP(k1,k2,k4)),min(disSP(k3,k4,k1),disSP(k3,k4,k2)));
}
int onS(point k1,point k2,point q){return inmid(k1,k2,q)&&sign(cross(k1-q,k2-k1))==0;}
struct circle{
    point o; db r;
    void scan(){o.scan(); scanf("%lf",&r);}
    int inside(point k){return cmp(r,o.dis(k))>=0;}
};
int checkposCC(circle k1,circle k2){// 返回两个圆的公切线数量
    if (cmp(k1.r,k2.r)==-1) swap(k1,k2);
    db dis=k1.o.dis(k2.o);  int w1=cmp(dis,k1.r+k2.r),w2=cmp(dis,k1.r-k2.r);
    if (w1>0) return 4; else if (w1==0) return 3; else if (w2>0) return 2;
    else if (w2==0) return 1; else return 0;
}
vector<point> getCC(circle k1,circle k2){// 沿圆 k1 逆时针给出 , 相切给出两个
    int pd=checkposCC(k1,k2); if (pd==0||pd==4) return {};
    db a=(k2.o-k1.o).abs2(),cosA=(k1.r*k1.r+a-k2.r*k2.r)/(2*k1.r*sqrt(max(a,(db)0.0)));
    db b=k1.r*cosA,c=sqrt(max((db)0.0,k1.r*k1.r-b*b));
    point k=(k2.o-k1.o).unit(),m=k1.o+k*b,del=k.turn90()*c;
    return {m-del,m+del};
}
int n;
circle c[2005];
db S(db r,db h){
    return 2.0*pi*r*h;
}
db slove(int x){
    vector<circle>v;
    vector<point>p;
    for(int i=1;i<=n;i++)if(i!=x)v.push_back(c[i]);
    db down = c[x].o.y-c[x].r;db up = down+c[x].r*2;
    for(int i=0;i<n-1;i++){
        p = getCC(v[i],c[x]);
        if(p.size()){
            if(v[i].o.y<c[x].o.y) down = max(down,p[0].y);
            else up = min(up,p[0].y);
        }else{
            if(v[i].inside(c[x].o)&&c[x].o.dis(v[i].o)+c[x].r<=v[i].r){
//                printf("%d %.11f\n",x,v[i].o.y);
                return 0.0;//这个圆被吃了
            }
        }
        p.clear();
    }
    down = max(down,0.0);
    up = max(up,0.0);
    down = max(down,c[x].o.y-c[x].r);
    up = min(up,c[x].o.y+c[x].r);
    //这个圆还剩[down,up]
    db h = c[x].o.y;
    if(up >= h && down >= h){//上半球down-up
        down-=h;up-=h;
        return S(c[x].r, c[x].r - down) - S(c[x].r, c[x].r - up);
    }else if(up <= h && down <= h){//下半球up-down
        up=h-up;down=h-down;
        return S(c[x].r,c[x].r-up)-S(c[x].r,c[x].r-down);
    }else if(up>=h&&down<=h){//两个半球加
        up-=h;down=h-down;
        return 4*pi*c[x].r*c[x].r-S(c[x].r,c[x].r-up)-S(c[x].r,c[x].r-down);
    }
    return 0.0;
}
int main(){
    scanf("%d",&n);
    //球冠表面积:2pirh
    //db h = 7*24 = 168/12 = 14
    //一共长了 14 feet
    db v;
    for(int i=1;i<=n;i++){
        scanf("%lf%lf",&c[i].o.y,&v);
        c[i].o.x=0;
        c[i].r=v*14;
    }
    db ans = 0;
    for(int i=1;i<=n;i++){
        ans+=max(0.0,slove(i));
//        printf("%11f\n",slove(i));
    }
    printf("%.11f\n",ans);
}
01-04 04:48