题意:已知p1,p2,p3三点求抛物线和直线围成的面积。
核心代码就一行,结果够推两个小时了。
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main()
{
double x1,x2,x3,y1,y2,y3;
double res;
int T;
cin>>T;
while(T--)
{
cin>>x1>>y1>>x2>>y2>>x3>>y3;
res = (y1-y3)*(x3-x2)-((y1-y3)*(pow((x3-x1),3)-pow((x2-x1),3)))/(3.0*(x1-x3)*(x1-x3))+(y3-y2)*(x3-x2)/2.0;
printf("%.2lf
",res);
}
return 0;
}