您的位置:首页 > 其它

题目1089:数字反转

2017-04-16 22:20 369 查看

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
#include <stack>
#include <string>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <map>
#include <functional>
#include <set>
#include <limits.h>
#include <math.h>
#include <ctype.h>
using namespace std;
//1089
int n,a,b;
int tran(int x)
{
    int y=0;
    do{
        y=y*10+x%10;
        x/=10;
    }while(x);
    return y;
}
int main()
{  
    while(cin>>n)
    {
        while(n--)
        {
            cin>>a>>b;
            int c=a+b;
            if( tran(c) == tran(a)+tran(b) )
                cout<<c<<endl;
            else
                cout<<"NO"<<endl;
        }
    }
    return 0;
}
 
/**************************************************************
    Problem: 1089
    User: cust123
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:1520 kb
****************************************************************/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: