Point:
1、公式
$$ tmp = tmp + a[i] + (i < b.size() \; ? \; b[i] \; : \; 0)$$
#include <iostream>
#include <vector>
using namespace std;
// 加引用 快
vector<int> Vplus(vector<int>& a, vector<int>& b)
{
if(a.size() < b.size()) return Vplus(b, a);
vector<int> c;
int t = 0;
for(int i = 0; i < a.size(); ++ i)
{
t += a[i];
if(i < b.size()) t += b[i];
c.push_back(t % 10);
t /= 10;
}
if(t) c.push_back(t);
return c;
}
int main()
{
string a, b;
vector<int> A, B;
cin >> a >> b;
// 逆序输入
for (int i = a.size() - 1; i >= 0; --i) A.push_back((int)(a[i] - '0'));
for (int i = b.size() - 1; i >= 0; --i) B.push_back((int)(b[i] - '0'));
A = Vplus(A, B);
// 逆序输出
for (int i = A.size() - 1; i >= 0; --i) cout << A[i];
}