結果
| 問題 | No.132 点と平面との距離 |
| コンテスト | |
| ユーザー |
LayCurse
|
| 提出日時 | 2014-11-13 07:37:24 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 5,000 ms |
| コード長 | 1,013 bytes |
| 記録 | |
| コンパイル時間 | 1,492 ms |
| コンパイル使用メモリ | 175,624 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-04 21:26:53 |
| 合計ジャッジ時間 | 1,972 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int N;
double X[301], Y[301], Z[301];
int main(){
int i, a, b, c;
double dx, dy, dz;
double d1, d2, d3, ss, s, v;
double res;
scanf("%d",&N);
scanf("%lf%lf%lf",&dx,&dy,&dz);
rep(i,N) scanf("%lf%lf%lf",X+i,Y+i,Z+i), X[i]-=dx, Y[i]-=dy, Z[i]-=dz;
res = 0;
rep(a,N) REP(b,a+1,N) REP(c,b+1,N){
d1 = sqrt( (X[a]-X[b])*(X[a]-X[b]) + (Y[a]-Y[b])*(Y[a]-Y[b]) + (Z[a]-Z[b])*(Z[a]-Z[b]) );
d2 = sqrt( (X[b]-X[c])*(X[b]-X[c]) + (Y[b]-Y[c])*(Y[b]-Y[c]) + (Z[b]-Z[c])*(Z[b]-Z[c]) );
d3 = sqrt( (X[c]-X[a])*(X[c]-X[a]) + (Y[c]-Y[a])*(Y[c]-Y[a]) + (Z[c]-Z[a])*(Z[c]-Z[a]) );
ss = (d1+d2+d3) / 2;
s = sqrt(ss*(ss-d1)*(ss-d2)*(ss-d3));
v = (X[a]*Y[b]*Z[c] + X[b]*Y[c]*Z[a] + X[c]*Y[a]*Z[b] - X[c]*Y[b]*Z[a] - X[b]*Y[a]*Z[c] - X[a]*Y[c]*Z[b]) / 6;
v = max(v, -v) * 3;
res += v / s;
}
printf("%.15f\n", res);
return 0;
}
LayCurse