题解 | #a+b#
a+b
https://www.nowcoder.com/practice/4c39c984ea3848b48e111b8e71ec1dd4
#include <iostream> #include<vector> using namespace std; int main() { string a,b; while(cin>>a>>b) { vector<int>v; int temp=0; int m=a.length(),n=b.length(); for(int i=0;i<m||i<n;i++) { if(i<m)temp+=a[m-1-i]-'0'; if(i<n)temp+=b[n-i-1]-'0'; v.push_back(temp%10); temp=temp/10; } if(temp!=0)v.push_back(temp); for(int i=v.size()-1;i>=0;i--) cout<<v[i]; cout<<endl; } } // 64 位输出请用 printf("%lld")