#include<iostream>
#include<vector>

using namespace std;

vector <short> y;

int main()
{
	
	string n,m;
	cin >> n >> m;
	
	for(int i = 0; i < n.size() || i < m.size(); i++){
	
		y.push_back((((n[i] - '0') + (m[i] - '0')) % 10));
		
		if((n[i] - '0') + (m[i] - '0') >= 10){
			
			if(i == 0){
				
				cout << 1;
			}
			
			else{
				
				y[i - 1]++;
			}
		}
	}
	
	for(int i = 0; i < y.size(); i++){
		
		cout << y[i];
	}
	
	return 0;
 } 

发完帖后我才发现代码有bug...

1 comments

  • 1