代码
#include<cstdio>
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int x;
char a[500],b[500],c[501];
void add(){
if(strlen(a) > strlen(b)) x = strlen(a);
else x = strlen(a);
for(int i = x - 1;i > -1;i--){
c[i] += (a[i] - '0') + (b[i] - '0');
if(c[i] > 9){
c[i] -= 9;
c[i - 1] += 1;
}
}
}
int main(){
scanf("%s",&a);
scanf("%s",&b);
for(int i = 0;i < x;i++){
swap(a[i],a[499 - i]);
swap(b[i],b[499 - i]);
}
add();
for(int i = x - 1;i > -1;i--) c[i] += '0';
for(int i = 0;i < x;i++) swap(c[i],c[500 - i]);
printf(c);
return 0;
}