#include<bits/stdc++.h>
#include<string>
using namespace std;
const int N=1e3+10;
int s[N*N]={0};
char a[N*N],b[N*N];
int main()
{
cin>>a>>b;
int tot=0,tot1=0,i=strlen(a)-1,j=strlen(b)-1;
while(i>=0)
{
int sw1=a[i]-'0';
tot=tot1;
while(j>=0)
{
int sw2=b[j]-'0';
int dan=sw2*sw1;
if(s[tot]+dan<10)
{
s[tot]+=dan;
}
else
{
s[tot]+=(dan+s[tot])%10;
s[++tot]+=(dan+s[tot-1])/10;
}
tot++;
j--;
}
j=strlen(b)-1;
i--;
tot1++;
}
for(int i=tot-1;i>=0;i--)
{
printf("%d",s[i]);
}
return 0;
}
粗略估计错在34--36行,但我不知道如何改?求救!!