纯数学积分,好久没写数学题了,大一学的高数都忘得差不多了……
/* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <queue> #define INF 1E9 using namespace std; int main() { double x1,x2,x3,y1,y2,y3,a,k,b,ans; int T; scanf("%d",&T); while(T--) { scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3); a=(y2-y1)/((x2-x1)*(x2-x1)); k=(y3-y2)/(x3-x2); b=y3-k*x3; int t=x3-x1,p=x2-x1; ans=a*(t*t*t-p*p*p)/3.0+y1*(x3-x2)-k*(x3*x3-x2*x2)/2.0-b*(x3-x2); printf("%.2f\n",ans); } }