两个大数相加
#include<iostream>
#include<vector>
#include<cstring>
vectro<int> sum(vector<int> &a,vector<int> &b){
vector<int> c ;
int t = 0;
for(int i = 0 , j = 0 ; i < a.size()||j<b.size();){
if(i<a.size())t += a[i++];
if(j < b.size()) t += b[j++];
c.push_back(t%10);
t /= 10;
}
if(t)c.push_back(t);
return c;
int main(){
string s1, s2;
cin>>s1>>s2;
vector<int>a,b;
for(int i = s1.size()-1;i>=0 ; i--)a.push_back(s1[i]-'0');
for(int i = s2.size()-1;i>=0 ;i--)b.push_back(s2[i]-'0');
auto res = sum(a,b);
for(int i = res.size()-1 ; i >=0 ;i-- ){
printf("%d",res[i]);
}
return 0;
}
}