杭电ACM1071The area———求积分面积
最后更新于:2022-04-01 09:47:45
~~~
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{ int t;
double x1,y1,x2,y2,x3,y3,a,k,s;
cin>>t;
while(t--)
{ cin>>x1>>y1>>x2>>y2>>x3>>y3;
a=(y2-y1)/((x2-x1)*(x2-x1));
k=(y2-y3)/(x2-x3);
s=a/3*(x3*x3*x3-x2*x2*x2)+(a*x1*x1+k*x3+y1-y3)*(x3-x2)+0.5*(2*a*x1+k)*(x2*x2-x3*x3);
printf("%.2f\n",s);
}
return 0;
}
~~~