http://acm.hdu.edu.cn/showproblem.php?pid=1071
#include<stdio.h>
#include<string.h>
int main()
{
//freopen("in.txt","r",stdin);
int t;
scanf("%d",&t);
while(t--)
{
double x1,y1,x2,y2,x3,y3;
double k,t,a,b,c;
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
k=(y3-y2)/(x3-x2);
t=y3-k*x3;
a=(y2-y1)/((x2-x1)*(x2-x1));
b=-2*a*x1;
c=y1+a*x1*x1;
double s=a/3*(x3*x3*x3-x2*x2*x2)+(b-k)/2*(x3*x3-x2*x2)+(c-t)*(x3-x2);
printf("%.2lf\n",s);
}
return 0;
}
时间: 2024-10-13 18:36:56