哪里有问题?算都算不对

P1303 A*B Problem

oqso @ 2022-07-12 22:45:29

#include<iostream>
#include<ctime>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<vector>
const int X=5000+10;
const int INF=0x3f3f3f3f;
typedef long long ll;
using namespace std;

char la[X]={0},lb[X]={0};
int len1,len2,len3,l1[X],l2[X],l3[2*X]={0},i,j;
int main(){
    cin>>la>>lb;
    len1=strlen(la),len2=strlen(lb);
    for(i=0;i<len1;i++) l1[i]=la[len1-i]-'0';
    for(i=0;i<len2;i++) l2[i]=lb[len2-i]-'0';
    for(i=0;i<len1;i++) for(j=0;j<len2;j++) l3[i+j]+=l1[i]*l2[j];
    len3=len1+len2;
    for(i=0;i<len3;i++){
        if(l3[i]>9) l3[i+1]+=l3[i]/10,l3[i]%=10;
    }
    for(;!l3[len3];) len3--;
    for(i=len3;i>=0;i--)    cout<<l3[i];
    return 0;
}

by sleepwalking1 @ 2022-07-13 13:43:16

你超勇 算都算不对还理直气壮地问哪里有问题? 就这句话,我就不给你解答了


by LeiZeProMax @ 2022-07-16 08:44:57

python它不香吗?``` print(int(input())*int(input()))


by oqso @ 2022-09-18 21:12:29

@sleepwalking1 哈哈哈


|