末然Ender @ 2021-11-17 18:26:33
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin>>a>>b;
int aa[2999]={0},bb[2999]={0},ans[2999]={0};
int c=0;
int lena=a.length()-1;
int lenb=b.length()-1;
int len=lena+lenb;
for(int i=0;i<=lena;i++){
aa[i]=a[lena-i]-'0';
}
for(int i=0;i<=lenb;i++){
bb[i]=b[lenb-i]-'0';
}
for(int i=0;i<=lena;i++){
for(int j=0;j<=lenb;j++){
ans[i+j]+=(aa[i]*bb[j]+c)%10;
c=(aa[i]*bb[j]+c)/10;
}
}
if(c>=1){
ans[len+1]=c;
len++;
}
while(ans[len]==0&&len>=0)len--;
for(int i=len;i>=0;i--)cout<<ans[i];
if(len==-1)cout<<0;
return 0;
}
by Otomachi_Una_ @ 2021-11-17 18:28:23
ans 开小了