题面
题解
据说这函数在\(x>15\)的时候趋近于\(0\)
据说当且仅当\(a<0\)时积分发散
所以直接套自适应\(simpson\)吧……
//minamoto#include#define R register#define fp(i,a,b) for(R int i=(a),I=(b)+1;i I;--i)#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)using namespace std;const double eps=1e-7;double a;inline double f(const R double &x){return pow(x,a/x-x);}inline double simpson(const R double &l,const R double &r){ return (r-l)*(f(l)+f(r)+4.0*f((l+r)/2))/6;}double query(double l,double r,double eps,double res){ double mid=(l+r)/2,ql=simpson(l,mid),qr=simpson(mid,r); if(fabs(ql+qr-res)<=15*eps)return ql+qr+(ql+qr-res)/15; return query(l,mid,eps/2,ql)+query(mid,r,eps/2,qr);}int main(){// freopen("testdata.in","r",stdin); scanf("%lf",&a); a<0?puts("orz"):printf("%.5lf\n",query(eps,20,eps,simpson(eps,20))); return 0;}