殇祭 @ 2017-12-23 08:46:41
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
int la,lb,lc,a[100001],b[1000],c[100001];
string s1,s2;
cin>>s1>>s2;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(c,0,sizeof(c));
la = s1.length();
lb = s2.length();
for (int i=0; i<la; i++) a[i]=s1[la-i-1]-48;
for (int i=0; i<lb; i++) b[i]=s2[lb-i-1]-48;
for (int i=0; i<la; i++)
for (int j=0; j<lb; j++){
c[i+j] += a[i] * b[j] ;
c[i+j+1] += c[i+j] / 10;
c[i+j] = c[i+j] % 10;
}
lc = la + lb;
while (lc>=1 && c[lc]==0) lc--;
for (int i=lc; i>=0; i--) cout<<c[i];
cout<<endl;
return 0;
}
by 殇祭 @ 2017-12-23 09:12:22
找到了,精度开小了--_--