xiuer_ @ 2023-09-10 19:55:54
#include<bits/stdc++.h>
using namespace std;
const int N=502;
char stra[N],strb[N];
int a[N],b[N],c[N*2];
int lena,lenb,len,w;
int main(){
cin>>stra+1;
cin>>strb+1;
lena=strlen(stra+1);
lenb=strlen(strb+1);
len=lena+lenb;
for(int i=1;i<=lena;i++){
a[i]=stra[lena+1-i]-'0';
}
for(int i=1;i<=lenb;i++){
b[i]=strb[lenb+1-i]-'0';
}
int t=0;
for(int i=1;i<=lena;i++){
for(int j=1;j<=lenb;j++){
c[i+j-1]+=a[i]*b[j];
}
}
for(int i=1;i<=len;i++){
c[i+1]+=c[i]/10;
c[i]%=10;
}
while(c[len]==0){
len--;
}
for(int i=max(len,1);i>=1;i--){
cout<<c[i];
}
}
by ImposterAnYu @ 2023-09-10 19:58:56
每个非负整数不超过
by 035966_L3 @ 2023-09-10 20:15:40
@ImposterAnYu 不,
by lpstudio @ 2023-09-10 20:47:32
@xiuer_ 头像很阳光开朗
by ImposterAnYu @ 2023-09-10 21:29:33
@035966_L3 放在这个程序里是这样的,但是要是下一次他不const int或者define了呢