結果
| 問題 | No.132 点と平面との距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-22 14:56:25 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 343 ms / 5,000 ms |
| コード長 | 1,244 bytes |
| 記録 | |
| コンパイル時間 | 1,291 ms |
| コンパイル使用メモリ | 107,776 KB |
| 実行使用メモリ | 24,064 KB |
| 最終ジャッジ日時 | 2024-06-23 00:19:13 |
| 合計ジャッジ時間 | 2,336 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
namespace yukicoder
{
class Vector3{
public double x,y,z;
public Vector3(double _x,double _y,double _z){ x=_x;y=_y;z=_z; }
public Vector3():this(0,0,0){}
public Vector3(double[] a):this(a[0],a[1],a[2]){}
public static Vector3 operator-(Vector3 s,Vector3 o) { return new Vector3(s.x-o.x,s.y-o.y,s.z-o.z); }
public Vector3 cross_product(Vector3 o) { return new Vector3(y*o.z-z*o.y,z*o.x-x*o.z,x*o.y-y*o.x); }
public double inner_product(Vector3 o) { return x*o.x+y*o.y+z*o.z; }
public double norm() { return Math.Sqrt(x*x+y*y+z*z); }
}
class Program
{
public static void Main(string[] args)
{
int n;
Vector3 P;
Vector3[] l;
double sum;
n = int.Parse(Console.ReadLine());
P = new Vector3(Console.ReadLine().Split(' ').Select(x=>double.Parse(x)).ToArray());
l = new Vector3[300];
for(int i=0;i<n;i++){
l[i] = (new Vector3(Console.ReadLine().Split(' ').Select(x=>double.Parse(x)).ToArray()))-P;
}
sum=0;
for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)for(int k=j+1;k<n;k++){
Vector3 t = (l[j]-l[i]).cross_product(l[k]-l[i]);
sum += Math.Abs(l[i].inner_product(t))/t.norm();
}
Console.WriteLine(sum);
}
}
}