結果
| 問題 | No.132 点と平面との距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-21 00:44:55 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 544 bytes |
| 記録 | |
| コンパイル時間 | 119 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 18,560 KB |
| 最終ジャッジ日時 | 2024-06-22 23:29:42 |
| 合計ジャッジ時間 | 9,434 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 -- * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
require 'matrix'
class Vector
def outer_product(o)
raise 'outer_product is size3 only(size#{self.size})' unless size == 3
Vector[
self[1]*o[2]-self[2]*o[1],
self[2]*o[0]-self[0]*o[2],
self[0]*o[1]-self[1]*o[0],
]
end
end
def g;gets.split.map(&:to_f)end
def cross(a,b)
[a[1]*b[2]-a[2]-b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]
end
n=gets.to_i
p=Vector[*g]
q=(1..n).map{Vector[*g]}
sum=0
q.combination(3){|a,b,c|
t=(b-a).outer_product(c-a)
sum+=(p.inner_product(t)-a.inner_product(t)).abs/t.norm
}
p sum