1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
using namespace std;
int max(int a, int b)
{
  return (a > b) ? a : b;
}
int num(int n)
{
  return (n > 0) ? n : 0;
}
int main()
{
  ios_base::sync_with_stdio(false);
cin.tie(NULL);
  unsigned long long m, n;
  m = 0;
  string a, b, c = "";
  cin >> a >> b;
  for(int i = 1; i <= max(a.size(), b.size()); i++)
  {
    int d = (num((int)(a[a.size() - i]-48))+num((int)(b[b.size() - i]-48))+m);
    c = (char)((d%10)+48) + c;
    m = d/10;

  }
  if(m > 0)
  cout << m;
  cout << c;

}