积分的题目还是第一次做,直接用到了高数的知识,恩,还有,曲线的方程用顶点式y = a(x-h)^2+l, (h,l) 为顶点

注意精度问题

#include<stdio.h>
#include<math.h>
double x,y,x2,y2,x3,y3,area;
double l,h,a,k,b;
double f(double x)
{return (a*x*x*x/3)-(a*h+k/2)*x*x+(a*h*h+l-b)*x;}
int main()
{
    
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&x,&y,&x2,&y2,&x3,&y3);
        h=x;l=y;a=(y2-y)/((x2-x)*(x2-x));
        k=(y3-y2)/(x3-x2);b=y2-k*x2;
        printf("%.2lf\n",f(x3)-f(x2));       
    }
    return 0;
}

相关文章:

  • 2022-01-11
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-11-17
猜你喜欢
  • 2021-09-20
  • 2021-04-20
  • 2021-09-26
  • 2022-01-16
  • 2022-12-23
  • 2022-01-22
相关资源
相似解决方案