結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-01-21 19:44:34 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 880 bytes | 
| コンパイル時間 | 1,319 ms | 
| コンパイル使用メモリ | 160,000 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-22 23:32:19 | 
| 合計ジャッジ時間 | 1,743 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 3 | 
ソースコード
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
template <typename T> struct Vector3 {
public:
	T x,y,z;
	Vector3(T x,T y,T z):x(x),y(y),z(z){}
	Vector3(){Vector3(0,0,0);}
	Vector3<T> operator-(const Vector3<T> &o) const { return Vector3<T>(x-o.x,y-o.y,z-o.z); }
	Vector3<T> outer_product(const Vector3<T> &o) const { return Vector3<T>(y*o.z-z*o.y,z*o.x-x*o.z,x*o.y-y*o.x); }
	T inner_product(const Vector3<T> &o) const { return x*o.x+y*o.y+z*o.z; }
	T norm() const { return sqrt(x*x+y*y+z*z); }
};
int main(){
	int n;
	Vector3<double> P,l[300];
	double sum;
	cin>>n;
	cin>>P.x>>P.y>>P.z;
	for(int i=0;i<n;i++){
		cin>>l[i].x>>l[i].y>>l[i].z;
	}
	sum=0;
	for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)for(int k=j+1;k<n;k++){
		Vector3<double> t = (l[j]-l[i]).outer_product(l[k]-l[i]);
		sum += abs(l[i].inner_product(t))/t.norm();
	}
	cout<<sum<<endl;
	return 0;
}
            
            
            
        