捞一捞,求助

P1303 A*B Problem

藤原とうふ店 @ 2019-07-18 20:51:12

就是这个


by charliegong @ 2019-07-18 20:55:37

看一看,不会做


by 小元勋 @ 2019-07-18 21:46:06

直接Python做


by Drunkyous @ 2019-07-18 22:00:21

#include <bits/stdc++.h>
#define Maxn 10000009
using namespace std;
char c0[Maxn];
char c1[Maxn],c2[Maxn];
long long n,ans;
int mark;
int main()
{
    scanf("%s",c0);
    cin>>n;
    int len0=strlen(c0);

    if(len0>1){
        int nn=1;
        int maxn;
        int a=c0[len0-1]-'0';
        ans=a*n;
        maxn=Maxn-1;
        memset(c1,'0',Maxn);
        while(ans>0){
            c1[maxn--]=ans%10+48;
            ans/=10;
        }
        for(int i=len0-2;i>EOF;i--){
            nn++;
            a=c0[i]-'0';
            cout<<a<<endl;
            ans=a*n;
            maxn=Maxn-nn;
            memset(c2,'0',Maxn);
            while(ans>0){
                c2[maxn--]=ans%10+48;
                ans/=10;
            }
            int j=Maxn-1;
            int d,b;
            d=0,b=0;
            ans=a*n;
            int k=nn-1;
            while(c1[j]!='0' || c2[j]!='0' || ans>0){
                b=c1[j]+c2[j]-'0'-'0'+d;
                c1[j]=b%10+'0';
                d=b/10;
                j--;
                (k==0)?ans/=10:k--;
            }
            c1[j]=d+'0';
            mark=j;
        }

        for(int i=mark+1;i<Maxn;i++){
            cout<<c1[i];
        }
        cout<<endl;
    }else{
        long long ANS=(c0[0]-'0')*n;
        cout<<ANS<<endl;
    }
    return 0;
}

把双斜杠去掉ac第一个点乐


|