結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  koyopro | 
| 提出日時 | 2020-01-05 00:49:48 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 2,096 bytes | 
| コンパイル時間 | 2,210 ms | 
| コンパイル使用メモリ | 160,128 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-22 21:52:06 | 
| 合計ジャッジ時間 | 1,871 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 3 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)
int dxy[] = {0, 1, 0, -1, 0};
/*================================*/
int N,M,L;
template<typename T> struct Pos {
    T x, y, z;
    Pos(){};
    Pos(T _x, T _y): x(_x), y(_y){};
    Pos(T _x, T _y, T _z): x(_x), y(_y), z(_z){};
    
    Pos operator * (T t) {
        return Pos(t * x, t * y, t * z);
    }
    Pos operator + (Pos q) {
        return Pos(x + q.x, y + q.y, z + q.z);
    }
    Pos operator - (Pos q) {
        return Pos(x - q.x, y - q.y, z - q.z);
    }
    int dot(Pos q) {
        return x*q.x + y*q.y + z*q.z;
    }
    Pos det(Pos q) {
        return Pos( y*q.z - z*q.y ,
                   z*q.x - x*q.z ,
                   x*q.y - y*q.x );
    }
    bool operator == (Pos q) {
        return (x == q.x) && (y == q.y) && (z == q.z);
    }
    Pos operator * ( const Pos& q ) {
        return det(q);
    }
    T operator % ( const Pos& q ) {
        return dot(q);
    }
    T norm() {
        return sqrt(x*x + y*y + z*z);
    }
};
typedef Pos<double> pos;
pos p;
vector<pos> X(444);
double dist(int i, int j, int k) {
    pos a = X[i], b = X[j], c = X[k];
    pos pa =a-p, pb=b-p, pc=c-p;
    auto v = ((pa * pb) % pc);
    auto s = ((b-a)*(c-a)).norm();
    return abs(v/s);
}
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin>>N;
    cin>>p.x>>p.y>>p.z;
    REP(i,N)cin>>X[i].x>>X[i].y>>X[i].z;
    
    double ans = 0;
    
    FOR(i,0,N-2) FOR(j,i+1,N-1) FOR(k,j+1,N) {
        ans += dist(i,j,k);
    }
    
    out("%.14lf\n", ans);
    
    return 0;
}
            
            
            
        