plmnbvcxz4 @ 2024-12-27 09:59:37
using namespace std;
const int N=2e3+10;
char a[N],b[N];
int c[N];
int main(){
scanf("%s%s",a+1,b+1);
int lena=strlen(a+1);
int lenb=strlen(b+1);
reverse(a+1,a+lena+1);
reverse(b+1,b+lenb+1);
for(int i=1;i<=lena;i++)
if(a[i]>='0')a[i]-='0';
for(int i=1;i<=lenb;i++)
if(b[i]>='0')b[i]-='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<=lena+lenb;i++)
if(c[i]>9){
c[i+1]+=c[i]/10;
c[i]%=10;
}
int len=lena+lenb;
while(c[len]==0&&len>1)len--;
reverse(c+1,c+len+1);
for(int i=1;i<=len;i++)
cout<<c[i];
return 0;
}
by Mr_Terminator @ 2024-12-27 10:04:56
@plmnbvcxz4 结果可能达到
by __Unsigned__ @ 2024-12-27 13:24:27
我的问题,已删@LionBlaze
by LionBlaze @ 2024-12-27 13:24:58
@Unsigned 同时我问你你的 P8193 是如何 AC 的。
by __Unsigned__ @ 2024-12-27 13:26:22
@LionBlaze比如?
by LionBlaze @ 2024-12-27 13:29:25
@Unsigned 比如代码长度
by __Unsigned__ @ 2024-12-27 19:22:13
自己在提交记录里搜我的名字