結果
| 問題 | No.132 点と平面との距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-31 19:18:47 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 5,000 ms |
| コード長 | 1,922 bytes |
| 記録 | |
| コンパイル時間 | 1,035 ms |
| コンパイル使用メモリ | 112,896 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 21:45:30 |
| 合計ジャッジ時間 | 1,490 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
using real = double;
static constexpr real EPS = 1e-10;
struct Point3 {
real x, y, z;
Point3& operator+=(const Point3 a) { x += a.x; y += a.y; z += a.z; return *this; }
Point3& operator-=(const Point3 a) { x -= a.x; y -= a.y; z -= a.z; return *this; }
Point3& operator*=(const real k) { x *= k; y *= k; z *= k; return *this; }
Point3& operator/=(const real k) { x /= k; y /= k; z /= k; return *this; }
Point3 operator+(const Point3 a) const {return Point3(*this) += a; }
Point3 operator-(const Point3 a) const {return Point3(*this) -= a; }
Point3 operator*(const real k) const {return Point3(*this) *= k; }
Point3 operator/(const real k) const {return Point3(*this) /= k; }
Point3 (real a = 0, real b = 0, real c = 0) : x(a), y(b), z(c) {};
};
inline real dot(Point3 a, Point3 b){ return a.x*b.x + a.y*b.y + a.z*b.z; }
inline real abs(Point3 a){ return sqrt(dot(a, a)); }
inline Point3 cross(Point3 a, Point3 b){ return {a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x}; }
istream& operator>> (istream& s, Point3& P){
s >> P.x >> P.y >> P.z;
return s;
}
int main() {
int n;
cin >> n;
Point3 P;
cin >> P;
vector<Point3> v(n);
for (auto &&i : v) {
cin >> i;
i -= P;
}
real ans = 0;
for (int i = 0; i < n; ++i) {
for (int j = i+1; j < n; ++j) {
for (int k = j+1; k < n; ++k) {
ans += abs(dot(v[i], cross(v[j], v[k]))/abs(cross(v[j]-v[i], v[k]-v[i])));
}
}
}
printf("%.15lf\n", ans);
return 0;
}