//很裸的积分题,直接上模板
#include<stdio.h> #include<math.h> int aa, bb; //函数
double F(double x){
return sqrt((-x*x/aa/aa)*bb*bb);
} //三点simpson法
double simpson(double a,double b){
double c=a+(b-a)/;
return (F(a)+*F(c)+F(b))*(b-a)/;
} //自适应simpson公式(递归过程)。一直整个区间[a,b]上的三点simpson值A
double asr(double a,double b,double eps,double A){
double c=a+(b-a)/;
double L=simpson(a,c); double R=simpson(c,b);
if(fabs(L+R-A)<=*eps){
return L+R+(L+R-A)/;
}
return asr(a,c,eps,L)+asr(c,b,eps,R);
} //自适应simpson公式(主过程)
double asr(double a,double b,double eps){
return asr(a,b,eps,simpson(a,b));
} int main(){
int t;
scanf("%d",&t);
while(t--){
int l,r;
scanf("%d%d%d%d",&aa,&bb,&l,&r);
printf("%.3lf\n",asr(l,r,1e-)*);
}
}
05-14 09:57