class Solution {
public:
vector<int> addToArrayForm(vector<int>& num, int k) {
vector<int>a;
reverse(num.begin(),num.end());
while(k)
{
a.push_back(k%10);
k/=10;
}
vector<int>c;
int t=0;//进位
for(int i=0;i<num.size() || i<a.size();i++)
{
if(i<num.size()) t+=num[i];
if(i<a.size()) t+=a[i];
c.push_back(t%10);
t/=10;
}
if(t) c.push_back(1);
reverse(c.begin(),c.end());
return c;
}
};