結果
| 問題 | No.132 点と平面との距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-17 23:54:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 723 bytes |
| 記録 | |
| コンパイル時間 | 559 ms |
| コンパイル使用メモリ | 47,488 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 15:55:13 |
| 合計ジャッジ時間 | 1,068 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lf%lf%lf",&m[i][0],&m[i][1],&m[i][2]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
int N;
scanf("%d",&N);
vector<vector<double> >m(N+1);
for(int i=0;i<=N;i++){
m[i].resize(3);
scanf("%lf%lf%lf",&m[i][0],&m[i][1],&m[i][2]);
}
double R=0;
for(int a=1;a<=N;a++)for(int b=a+1;b<=N;b++)for(int c=b+1;c<=N;c++){{{
double A=(m[b][1]-m[a][1])*(m[c][2]-m[a][2])-(m[c][1]-m[a][1])*(m[b][2]-m[a][2]);
double B=(m[b][2]-m[a][2])*(m[c][0]-m[a][0])-(m[c][2]-m[a][2])*(m[b][0]-m[a][0]);
double C=(m[b][0]-m[a][0])*(m[c][1]-m[a][1])-(m[c][0]-m[a][0])*(m[b][1]-m[a][1]);
double D=-(A*m[a][0]+B*m[a][1]+C*m[a][2]);
double E=(A*m[0][0]+B*m[0][1]+C*m[0][2]+D);
R+=sqrt(E*E/(A*A+B*B+C*C));
}}}
printf("%.9f\n",R);
}