标签:
1 #include<stdio.h>//高数(1043) 2 #include<math.h> 3 double f(double n) 4 { 5 double t; 6 if(n>=0&&n<=2)t=4.0/3*pow(n,1.5)-0.4*pow(n,2.5); 7 else if(n>2&&n<=5)t=f(2)+0.25*pow(n,4)-2.0/3*pow(n,3)-0.5*pow(n,2)+2*n-6+16.0/3; 8 else t=f(5)+72*n-8.0/15*pow(n-5,15.0/8)-72*5; 9 return t; 10 } 11 int main() 12 { 13 int x; 14 double a,b; 15 scanf("%d",&x); 16 while(x--){ 17 scanf("%lf%lf",&a,&b); 18 printf("%d\n",(int)(f(b)-f(a)+0.5));//加0.5是为了进行四舍五入 19 } 20 return 0; 21 }
标签:
原文地址:http://www.cnblogs.com/minimalism/p/4537617.html