Menu

Asteroids

1
2
3
4
5
6
7
8
9
10
11
12
13
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;
	}
}