感动的无以复加的水题。你妹的我自从混进来以后就没有这么开心的面对过一道题啊!
明显的积分。只要搞出两条曲线的方程来再去积分就好了。两点求直线很好求。三点求抛物线列三元一次方程组然后适时地采用克莱姆法则问题就变得简单了~hiahia~我第一次觉得线代还是没有白学的
代码如下:
#include<stdio.h>
int main()
{
int n;
double x1,x2,x3,y1,y2,y3,k,a,b,c,h,s,s1,s2,s3,S;
scanf("%d",&n);
while(n--)
{
scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
k=(y3-y2)/(x3-x2);
h=y2-k*x2;
s=x1*x1*x2+x3*x2*x2+x3*x3*x1-x1*x1*x3-x1*x2*x2-x3*x3*x2;
s1=y1*x2+y2*x3+y3*x1-y3*x2-y1*x3-y2*x1;
s2=x1*x1*y2+x2*x2*y3+x3*x3*y1-x3*x3*y2-x2*x2*y1-x1*x1*y3;
s3=x1*x1*x2*y3+x2*x2*x3*y1+x3*x3*y2*x1-x3*x3*x2*y1-x2*x2*x1*y3-x1*x1*x3*y2;
a=s1/s;
b=s2/s;
c=s3/s;
S=a*(x3*x3*x3-x2*x2*x2)/3+(b-k)*(x3*x3-x2*x2)/2+(c-h)*(x3-x2);
printf("%.2lf\n",S);
}
return 0;
}
hiahia~~~