結果
| 問題 | No.132 点と平面との距離 | 
| コンテスト | |
| ユーザー |  LayCurse | 
| 提出日時 | 2014-11-13 07:33:23 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,013 bytes | 
| コンパイル時間 | 1,618 ms | 
| コンパイル使用メモリ | 161,280 KB | 
| 実行使用メモリ | 6,816 KB | 
| 最終ジャッジ日時 | 2024-12-31 10:10:09 | 
| 合計ジャッジ時間 | 2,063 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 WA * 2 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |   scanf("%d",&N);
      |   ~~~~~^~~~~~~~~
main.cpp:17:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |   scanf("%lf%lf%lf",&dx,&dy,&dz);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:18:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |   rep(i,N) scanf("%lf%lf%lf",X+i,Y+i,Z+i), X[i]-=dx, Y[i]-=dy, Z[i]-=dz;
      |            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int N;
double X[101], Y[101], Z[101];
int main(){
  int i, a, b, c;
  double dx, dy, dz;
  double d1, d2, d3, ss, s, v;
  double res;
  scanf("%d",&N);
  scanf("%lf%lf%lf",&dx,&dy,&dz);
  rep(i,N) scanf("%lf%lf%lf",X+i,Y+i,Z+i), X[i]-=dx, Y[i]-=dy, Z[i]-=dz;
  res = 0;
  rep(a,N) REP(b,a+1,N) REP(c,b+1,N){
    d1 = sqrt( (X[a]-X[b])*(X[a]-X[b]) + (Y[a]-Y[b])*(Y[a]-Y[b]) + (Z[a]-Z[b])*(Z[a]-Z[b]) );
    d2 = sqrt( (X[b]-X[c])*(X[b]-X[c]) + (Y[b]-Y[c])*(Y[b]-Y[c]) + (Z[b]-Z[c])*(Z[b]-Z[c]) );
    d3 = sqrt( (X[c]-X[a])*(X[c]-X[a]) + (Y[c]-Y[a])*(Y[c]-Y[a]) + (Z[c]-Z[a])*(Z[c]-Z[a]) );
    ss = (d1+d2+d3) / 2;
    s = sqrt(ss*(ss-d1)*(ss-d2)*(ss-d3));
    v = (X[a]*Y[b]*Z[c] + X[b]*Y[c]*Z[a] + X[c]*Y[a]*Z[b] - X[c]*Y[b]*Z[a] - X[b]*Y[a]*Z[c] - X[a]*Y[c]*Z[b]) / 6;
    v = max(v, -v) * 3;
    res += v / s;
  }
  printf("%.15f\n", res);
  
  return 0;
}
            
            
            
        