YANGKAIHAN1 @ 2021-11-13 07:55:21
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#define maxn 1001
using namespace std;
struct bigint{
int len,a[maxn];
bigint(){
len=0;
memset(a,0,sizeof(a));
}
int &operator[](int i){
return this->a[i];
}
void operator=(string s){
this->len=s.length();
int tmp=len;
while(this->a[++tmp]){
this->a[tmp]=0;
}
for(int i=1;i<=len;i++){
this->a[i]=s[len-i]-'0';
}
}
void operator=(bigint b){
this->len=b.len;
int tmp=len;
while(this->a[++tmp]){
this->a[tmp]=0;
}
for(int i=1;i<=len;i++){
this->a[i]=b.a[i];
}
}
void carry(int ln){
len=ln;
for(int i=1;i<=this->len;++i){
this->a[i+1]+=this->a[i]/10;
this->a[i]%=10;
}
while(!this->a[this->len])
--len;
}
void out(){
for(int i=max(this->len,1);i;i--){
printf("%d",this->a[i]);
}
}
};
bigint operator*(bigint a,bigint b){
bigint c;
memset(c.a,0,sizeof(c.a));
int lena=a.len;
int lenb=b.len;
for(int i=1;i<=lena;i++){
for(int j=1;j<=lenb;j++){
c.a[i+j-1]+=a.a[i]*b.a[j];
}
}
c.carry(lena+lenb+1);
return c;
}
int main(){
bigint a,b,c;
string A,B;
cin>>A>>B;
a=A;
b=B;
c=a*b;
c.out();
return 0;
}
by bolieriniefu @ 2021-11-18 21:25:54
a = int(input()) b = int(input()) print(a*b)