#include typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; struct Pt3d { double x,y,z; Pt3d(double a, double b, double c) : x(a), y(b), z(c) {} Pt3d operator+(const Pt3d &other) const { return Pt3d(x+other.x, y+other.y, z+other.z); } Pt3d operator-(const Pt3d &other) const { return Pt3d(x-other.x, y-other.y, z-other.z); } }; Pt3d cross(const Pt3d &a, const Pt3d &b) { return Pt3d(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); } double dot(const Pt3d &a, const Pt3d &b) { return a.x*b.x+a.y*b.y+a.z*b.z; } double norm(const Pt3d &a) { return sqrt(dot(a,a)); } class DistanceOfPointAndPlane { public: void solve(void) { int N; cin>>N; double x,y,z; double dist = 0; cin>>x>>y>>z; Pt3d p0(x,y,z); vector qs; REP(i,N) { cin>>x>>y>>z; qs.emplace_back(x,y,z); } REP(i,N) FOR(j,i+1,N) FOR(k,j+1,N) { auto p = qs[i]; auto n = cross(qs[j]-qs[i], qs[k]-qs[i]); // // plane(x,y,z) = n.x*(x-p.x) + n.y*(y-p.y) + n.z*(z-p.z) = 0 // |plane(x0,y0,z0)|/norm(n); // dist += abs(dot(n,p0-p))/norm(n); } cout<solve(); delete obj; return 0; } #endif