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);
    }
}


 

目录
相关文章
|
6月前
|
机器学习/深度学习 Java
hdu-2680-Choose the best route(dijkstra)
hdu-2680-Choose the best route(dijkstra)
29 0
|
算法
HDU-1050,Moving Tables(不用贪心也AC)
HDU-1050,Moving Tables(不用贪心也AC)
HDU-1071,The area(求面积水题)
HDU-1071,The area(求面积水题)
|
机器学习/深度学习
HDU-2680,Choose the best route(Dijkstra)
HDU-2680,Choose the best route(Dijkstra)
HDOJ(HDU) 2162 Add ‘em(求和)
HDOJ(HDU) 2162 Add ‘em(求和)
73 0