結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-06-06 20:47:49 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 83 ms / 5,000 ms | 
| コード長 | 875 bytes | 
| コンパイル時間 | 443 ms | 
| コンパイル使用メモリ | 63,264 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-06 14:31:35 | 
| 合計ジャッジ時間 | 929 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
const double EPS=1e-9;
const int N = 310;
double p[3];
double q[N][3];
double solve(int i, int j, int k) {
  double op[3];
  double op2 = 0;
  REP (a, 0, 3) {
    int b = (a + 1) % 3;
    int c = (a + 2) % 3;
    op[a] = (q[j][b] - q[i][b]) * (q[k][c] - q[i][c]) 
      - (q[j][c] - q[i][c]) * (q[k][b] - q[i][b]);
    op2 += op[a] * op[a];
  }
  double s = 0;
  REP(a,0,3) {
    s += (p[a] - q[i][a]) * op[a];
  }
  return abs(s) / sqrt(op2);
}
int main(void){
  int n;
  cin >> n >> p[0] >> p[1] >> p[2];
  REP (i, 0, n) {
    cin >> q[i][0] >> q[i][1] >> q[i][2];
  }
  double sum = 0;
  REP(i, 0, n) {
    REP(j, i + 1, n) {
      REP(k, j + 1, n) {
	sum += solve(i,j,k);
      }
    }
  }
  printf("%.10f\n", sum);
}
            
            
            
        