#include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string> using namespace std; string Add(string s1, string s2) {//高精度加法模板 int l1= s1.size(),l2 = s2.size(); if (l1 < l2)swap(s1, s2); reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); int car = 0; string s = ""; for (int i = 0; i < s2.size(); i++) { int num = (s1[i] - '0') + (s2[i] - '0') + car; char c = num % 10 + '0'; s = s + c; car = num / 10; } for (int i = s2.size(); i < s1.size(); i++) { int num = (s1[i] - '0') + car; char c = num % 10 + '0'; s = s + c; car = num / 10; } reverse(s.begin(),s.end()); while(s[0]==0)s.erase(0,1); return s; } int main() { string s1, s2; while (cin >> s1 >> s2) { string ans = Add(s1,s2); // cout<<ans.size()<<endl; cout<<ans<<endl; } } // 64 位输出请用 printf("%lld")