阅读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