蛇皮 @ 2020-02-12 12:56:38
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int c[4000],x[2000],y[2000];
int main()
{
string a,b;
cin>>a;
cin>>b;
int l1=a.length();
int l2=b.length();
int k=1;
for(int i=l1-1;i>=0;i--,k++)
{
x[k]=a[i]-'0';
}
k=1;
for(int i=l2-1;i>=0;i--,k++)
{
y[k]=b[i]-'0';
}
for(int i=1;i<=l1;i++)
{
for(int j=1;j<=l2;j++)
{
c[i-1+j-1+1]=c[i-1+j-1+1]+x[i]*y[j];
if(c[i-1+j-1+1]>10)
{
c[i-1+j-1+1+1]=c[i-1+j-1+1+1]+(c[i-1+j-1+1]/10);
c[i-1+j-1+1]%=10;
}
}
}
int l=l1+l2;
while(c[l]==0)
l--;
if(l<1)
cout<<"0";
for(int i=l;i>=1;i--)
cout<<c[i];
}
by Monkey_Hunter @ 2020-02-12 12:58:53
py
by long_long @ 2020-02-12 13:10:43
@蛇皮 你用的是高精吗?
by YosemiteHe @ 2020-02-12 13:36:44
@蛇皮 建议循环从0开始
by 蛇皮 @ 2020-02-12 16:21:55
@自动WA机私信我 py是啥
by Monkey_Hunter @ 2020-02-13 13:49:23
@蛇皮 python