Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
168741 | 刘子隽bylz | 高精度乘法 | C++ | 通过 | 100 | 1 MS | 264 KB | 573 | 2024-08-20 13:33:11 |
using namespace std; int i,j,a[5000]={0},b[5000]={0},c[25000000]={0},x,lena,lenb,lenc; int main(){ string ai,bi; getline(cin,ai); getline(cin,bi); lena=ai.length(); lenb=bi.length(); for(i=0;i<=lena-1;i++) a[lena-i]=ai[i]-'0'; for(i=0;i<=lenb-1;i++) b[lenb-i]=bi[i]-'0'; for(i=1;i<=lena;i++){ x=0; for(j=1;j<=lenb;j++){ c[i+j-1]=a[i]*b[j]+x+c[i+j-1]; x=c[i+j-1]/10; c[i+j-1]%=10; } c[i+lenb]=x; } lenc=lena+lenb; while(c[lenc]==0&&lenc>1) lenc--; for(i=lenc;i>=1;i--) cout<<c[i]; return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0