Menu

Asteroids

post on 21 Dec 2017 about 293words require 1min
CC BY 4.0 (除特别声明或转载文章外)
如果这篇博客帮助到你,可以请我喝一杯咖啡~
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;
	}
}
Loading comments...