文章
2
粉丝
140
获赞
1
访问
15.8k
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int a, b;
int r_of_sum, sum_of_r;
string sa, sb, ssum;
while(cin >> a){
cin >> b;
r_of_sum = a + b;
string tmp = to_string(r_of_sum);
reverse(tmp.begin(), tmp.end());
r_of_sum = atoi(tmp.c_str());
sa = to_string(a);
sb = to_string(b);
reverse(sa.begin(), sa.end());
reverse(sb.begin(), sb.end());
sum_of_r = atoi(sa.c_str()) + atoi(sb.c_str());
if(r_of_sum == sum_of_r){
cout << a + b << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发