結果

問題 No.132 点と平面との距離
ユーザー gigurururugigurururu
提出日時 2015-01-21 01:06:05
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 431 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 11,504 KB
実行使用メモリ 27,188 KB
最終ジャッジ日時 2023-09-05 02:41:50
合計ジャッジ時間 8,995 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,203 ms
17,312 KB
testcase_01 TLE -
testcase_02 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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;Vector[*gets.split.map(&:to_f)]end
n=gets.to_i
P=g
p((1..n).map{g-P}.combination(3).map{|a,b,c|
  t=(b-a).outer_product(c-a)
  a.inner_product(t).abs/t.norm
}.inject(:+))
0