如果这篇博客帮助到你,可以请我喝一杯咖啡~
CC BY 4.0 (除特别声明或转载文章外)
int main()
{
lf ans=0,x,y,z;
for(int n,m,flag=1; ~scanf("%d",&n);)
{
vector<Coord3> p;
for(; n--; p.push_back(Coord3(x,y,z)))
scanf("%lf%lf%lf",&x,&y,&z);
ConvexPolyhedron c(p);
ans+=c.dist(c.centroid());
if(flag^=1)printf("%.5f\n",ans),ans=0;
}
}