标签:math

2 5.000000 5.000000 0.000000 0.000000 10.000000 0.000000 10.000000 10.000000 1.000000 1.000000 14.000000 8.222222
33.33 40.69HintFor float may be not accurate enough, please use double instead of float.
#include<stdio.h>
int main()
{
double x1,x2,x3,y1,y2,y3,a,b,c,k,h,s;
int t,i;
scanf("%d",&t);
while(t--)
{
scanf("%lf %lf",&x1,&y1);
scanf("%lf %lf",&x2,&y2);
scanf("%lf %lf",&x3,&y3);
a=(y2-y1)/((x2-x1)*(x2-x1));
b=-2*a*x1;
c=y1-a*x1*x1-b*x1;
k=(y2-y3)/(x2-x3);
h=y2-k*x2;
s=a/3*(x3*x3*x3-x2*x2*x2)+(b-k)/2*(x3*x3-x2*x2)+(c-h)*(x3-x2);
printf("%.2lf\n",s);
}
return 0;
}
版权声明:本文为博主原创文章,随便转载。
标签:math
原文地址:http://blog.csdn.net/luwhere/article/details/47687055