代码求调

P1303 A*B Problem

ngs123 @ 2024-05-30 12:44:59

#include<bits/stdc++.h>
#define maxn 2000
using namespace std;
int a[maxn],b[maxn],c[maxn];
int main(){
    string A,B;
    cin>>A>>B;
    int len=max(A.length(),B.length());
    for(int i=A.length()-1,j=1;i>=0;i--,j++) a[j]=A[i]-'0';
    for(int i=B.length()-1,j=1;i>=0;i--,j++) b[j]=B[i]-'0';
    for(int i=1;i<=len;i++){
        c[i]+=a[i]*b[i];
        c[i+1]=c[i]/10;
        c[i]%=10;
    }
    if(c[len+1]!=0) len++;
    for(int i=len;i>=1;i--) cout<<c[i];
    return 0;
}

by 200921lyt @ 2024-07-19 11:11:16

偶遇


by ngs123 @ 2024-11-17 10:23:52

@200921lyt 666 666 6

6 6 6 6 6 6 6 6 6


|