閱讀684 返回首頁    go 阿裏雲 go 技術社區[雲棲]


hdu 1071 The area

 

    純數學積分,好久沒寫數學題了,大一學的高數都忘得差不多了……

 

/*
author:jxy
lang:C/C++
university:China,Xidian University
**If you need to reprint,please indicate the source**
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
#define INF 1E9
using namespace std;
int main()
{
    double x1,x2,x3,y1,y2,y3,a,k,b,ans;
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        a=(y2-y1)/((x2-x1)*(x2-x1));
        k=(y3-y2)/(x3-x2);
        b=y3-k*x3;
        int t=x3-x1,p=x2-x1;
        ans=a*(t*t*t-p*p*p)/3.0+y1*(x3-x2)-k*(x3*x3-x2*x2)/2.0-b*(x3-x2);
        printf("%.2f\n",ans);
    }
}


 

最後更新:2017-04-02 22:15:57

  上一篇:go 蘋果攜VMware為iPad打造企業雲計算版iWork
  下一篇:go uva 10391 - Compound Words