log by 51b

typedef int T[130];i,j,r,k,l,s,q;T a,b,c,t,u,v,e,o,z,w,y;G(T a,int n){bzero(a,520);a[10]=n;}A(T a,T b,int n,T c){for(i=130,r=0;i--;c[i]%=10,c[i]<0?c[i]+=10,r--:0)c[i]=r+a[i]+n*b[i],r=c[i]/10;}M(T a,T b,T c){for(i=130,r=0;i--;r=c[i]/10,c[i]%=10)for(c[i]=r,j=0;j<=i+10&j<130;j++)i-j<120?c[i]+=a[j]*b[i-j+10]:0;}L(int a,T b){q=9;for(G(b,log(a)+1),G(o,1);q--;A(b,e,a,z),A(z,o,-1,b))for(G(e,1),k=110;--k;A(o,y,-1,e))for(M(b,e,w),l=s=0;l<130;l++)s=s*10+w[l],y[l]=s/k,s=s%k;}main(n,m){scanf("%d%d",&n,&m);L(n,a);L(m,b);G(t,2);u[11]=4;for(k=9;k--;bcopy(c,u,520))M(b,u,c),A(t,c,-1,v),M(u,v,c);M(a,u,c);for(printf("%d.",c[n=10]);n<110;)printf("%d",c[++n]);}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page