1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=505; 4 int a[N],b[N],c[N]; 5 void get(string &s,int *p) 6 { 7 int n=s.size(); 8 for(int i=1;i<=n;i++) 9 p[i]=s[n-i]^48; 10 } 11 int main() 12 { 13 string s1,s2; 14 cin>>s1>>s2; 15 get(s1,a); 16 get(s2,b); 17 int n1=s1.size(),n2=s2.size(),len=max(n1,n2),i; 18 for(i=1;i<=len;i++) 19 { 20 c[i]+=a[i]+b[i]; 21 if(c[i]>9) 22 { 23 c[i+1]++; 24 c[i]%=10; 25 } 26 } 27 if(!c[i])i--; 28 for(;i>=1;i--) 29 printf("%d",c[i]); 30 return 0; 31 }