#include#include #include using namespace std;inline int max(int a,int b){ return a>b?a:b;}struct hpc{ int a[260],l;};hpc change(char s[]){ int len=0,l=strlen(s); hpc ans;memset(ans.a,0,sizeof(ans.a)); for(int i=l-1;i>=0;i-=4){ int t=0,k=max(i-3,0); for(int j=k;j<=i;j++) t=t*10+s[j]-'0'; ans.a[len++]=t; } ans.l=len; return ans;}void print(hpc a){ printf("%d",a.a[a.l-1]); for(int i=a.l-2;i>=0;i--) printf("%04d",a.a[i]); puts("");}hpc operator *(const hpc a,const hpc b){ hpc ans;int l; memset(ans.a,0,sizeof(ans.a)); if((a.l==1&&a.a[0]==0)||(b.l==1&&b.a[0]==0)) {ans.l=1;return ans;} for(int i=0;i 0){ ans.a[l+1]=ans.a[l]/10000; ans.a[l]%=10000; l++; } ans.l=l; return ans;}int main(){ char s[510]; scanf("%s",s);hpc a=change(s); scanf("%s",s);hpc b=change(s); a=a*b;print(a); return 0;}
本文由Yzyet编写,网址为www.cnblogs.com/Yzyet。非Yzyet同意,禁止转载,侵权者必究。