您的位置:首页 > 其它

定积分求面积

2014-05-24 11:55 183 查看
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: