记录编号 374760 评测结果 AAAAAAAAAAA
题目名称 [HNOI 2004] 金属包裹 最终得分 100
用户昵称 GravatarGo灬Fire 是否通过 通过
代码语言 C++ 运行时间 1.332 s
提交时间 2017-02-23 21:05:01 内存使用 0.31 MiB
显示代码纯文本
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define LL long long
#define Inf 2e9
#define eps 1e-12
const int maxn=1100;
double rand01(){return rand()/(double)2147483640;} 
double rand_eps(){return (rand01()-0.5)*eps*1e2;}
struct Point{
	double x,y,z;
	Point(double xx=0,double yy=0,double zz=0){
		x=xx;y=yy;z=zz;
	}
	void input(){scanf("%lf%lf%lf",&x,&y,&z);}
	void change(){
		x+=rand_eps();
		y+=rand_eps();
		z+=rand_eps();
	}
};
typedef Point Vector;

int dcmp(double x)
{return fabs(x)<eps ? 0 : x>0 ? 1 : -1;}

bool operator == (const Point A,const Point B)
{return dcmp(A.x-B.x)==0 && dcmp(A.y-B.y)==0 && dcmp(A.z-B.z)==0;}

Vector Cross(Vector A,Vector B){
	return Vector(A.y*B.z-B.y*A.z,
				  A.z*B.x-B.z*A.x,
				  A.x*B.y-B.x*A.y);
}

Vector operator - (Point A,Point B)
{return Vector(A.x-B.x,A.y-B.y,A.z-B.z);}

double Dot(Vector A,Vector B)
{return A.x*B.x+A.y*B.y+A.z*B.z;}

double Length(Vector A)
{return sqrt(Dot(A,A));}

Point p[maxn];
int n;
double Aera(Point A,Point B,Point C){
	Vector normal=Cross(B-A,C-A);
	int face_0=0,face_1=0;
	for(int i=1;i<=n;i++){
		if(p[i]==A || p[i]==B || p[i]==C)continue;
		if(dcmp(Dot(normal,A-p[i]))==-1)face_0++;
		else face_1++;
	}
	if(face_0==0 || face_1==0)return Length(normal)/2;
	return 0;
}
void Init();
int main(){
	freopen("enwrap.in","r",stdin);freopen("enwrap.out","w",stdout);
	srand(time(NULL));
    Init();
    getchar();getchar();
    return 0;
}
void Init(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		p[i].input();
		p[i].change();
	}
	double ans=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			for(int k=1;k<j;k++)
				ans+=Aera(p[i],p[j],p[k]);
	printf("%.6lf\n",ans);
}