Judgelight @ 2022-09-22 22:01:29
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 1009
using namespace std;
int x,y;
struct BigNumber{
int len,num[N];
};
BigNumber make(int n){
BigNumber big;
big.len=0;
while(n){
big.num[++big.len]=n%10;
n/=10;
}
return big;
}
BigNumber gjj(BigNumber a,BigNumber b){
int addnext=0;
BigNumber c;
c.len=0;
while(c.len<a.len||c.len<b.len){
c.num[++c.len]=a.num[c.len]+b.num[c.len]+addnext;
addnext=0;
if(c.num[c.len]>=10){
c.num[c.len]-=10;
addnext=1;
}
}
if(addnext){
c.num[++c.len]=addnext;
}
return c;
}
void Printf(BigNumber n){
for(int i=n.len;i>=1;i--){
cout<<n.num[i];
}
}
int main(){
cin>>x>>y;
Printf(gjj(make(x),make(y)));
return 0;
}
by Judgelight @ 2022-10-08 21:39:54
@Hughpig
谢谢