http://www.rqnoj.cn/Problem_377.html
#include #define LEN 5000 int a[LEN]={0},b[LEN]={0},result[LEN*3]={0}; int main() { int i=0,j,t,s,n,m; scanf("%d",&n); m=n%4; n=n/4; if(!m) n--; i=n; if(m==1) scanf("%1d",&a[i]); else if(m==2) scanf("%2d",&a[i]); else if(m==3) scanf("%3d",&a[i]); else if(m==0) i++;
i--; for(;i>=0;i--) scanf("%4d",&a[i]);
i=n; if(m==1) scanf("%1d",&b[i]); else if(m==2) scanf("%2d",&b[i]); else if(m==3) scanf("%3d",&b[i]); else if(m==0) i++; i--; for(;i>=0;i--) scanf("%4d",&b[i]); for (i=0;i<=n;i++) { t=0; for (j=0;j<=n;j++) { s=result[i+j]+a[i]*b[j]+t; result[i+j]=s%10000; t=s/10000; } result[i+j]=t; } for(i=LEN*3-1;i>=0;i--) if(result[i]) break; printf("%d",result[i--]); for(;i>=0;i--) printf("%04d",result[i]); printf("/n"); return 0; }