代码:
#include<bits/stdc++.h>
using namespace std;
int high(string a,string b){
int len_a=a.length();
int len_b=b.length();
int s_a[len_a]={0},s_b[len_b]={0};
int len_max=max(len_a,len_b);
int s_c[len_max+1]={0};
int x=0;
int c=0;
for(int i=len_a-1;i>=0;i--){
s_a[i]=a[i]-'0';
}
for(int i=len_b-1;i>=0;i--){
s_b[i]=b[i]-'0';
}
for(int i=len_max;i>=1;i--){
s_c[i]=s_a[i-1]+s_b[i-1]+x;
x=0;
if(s_c[i]>=10){
s_c[i]-=10;
x=1;
}
}
if(x==1){
s_c[0]=1;
}
for(int i=len_max;i>=0;i--){
c+=(s_c[i])*pow(10,(len_max-i));
}
return c;
}
int main(){
string a="",b="";
cin>>a>>b;
cout<<high(a,b);
return 0;
}
求调,谢谢