萌新求助,为什么有的结果准确有的不

P1303 A*B Problem

```cpp #include<bits/stdc++.h> using namespace std; string s1,s2; int a[2005],b[2005],c[20005]; int main() { cin>>s1>>s2; a[0]=s1.size(); b[0]=s2.size(); for(int i=1;i<=a[0];i++) { a[i]=s1[a[0]-i]-'0'; } for(int i=1;i<=b[0];i++) { b[i]=s2[b[0]-i]-'0'; } c[0]=a[0]+b[0]; int jw; for(int i=1;i<=b[0];i++) { jw=0; for(int j=1;j<=a[0];j++) { c[i+j-1]+=a[j]*b[i]+jw; jw=c[i+j-1]/10; c[i+j-1]%=10; } c[i+a[0]]=jw; } while(c[c[0]]==0&&c[0]>1) { c[0]--; } for(int i=c[0];i>=1;i--) cout<<c[i]; return 0; } ```
by shooting__star @ 2024-01-26 07:21:18


@[gyhwhitenight](/user/1030984)
by shooting__star @ 2024-01-26 07:21:28


@[shooting__star](/user/955954) 他在求调,你发个代码干什么?
by a590784 @ 2024-01-26 07:46:57


|