結果

問題 No.132 点と平面との距離
ユーザー gigurururugigurururu
提出日時 2015-01-22 09:56:45
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 387 ms / 5,000 ms
コード長 705 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 77,724 KB
実行使用メモリ 80,008 KB
最終ジャッジ日時 2023-09-05 03:32:44
合計ジャッジ時間 2,741 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
79,572 KB
testcase_01 AC 193 ms
79,688 KB
testcase_02 AC 387 ms
80,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools,math
class Vector3:
    def __init__(self,x=0,y=0,z=0):
        self.x,self.y,self.z=x,y,z
    def __sub__(self,o):
        return Vector3(self.x-o.x,self.y-o.y,self.z-o.z)
    def outer_product(self,o):
        return Vector3(self.y*o.z-self.z*o.y,self.z*o.x-self.x*o.z,self.x*o.y-self.y*o.x)
    def inner_product(self,o):
        return self.x*o.x+self.y*o.y+self.z*o.z
    def norm(self):
        return math.sqrt(self.x**2+self.y**2+self.z**2)

def g():
    return Vector3(*map(float,raw_input().split()))

n=input()
P=g()
l=[g()-P for _ in range(n)]
ans=0
for a,b,c in itertools.combinations(l,3):
    t=(b-a).outer_product(c-a)
    ans+=abs(a.inner_product(t))/t.norm()
print(ans)
0