poj1504

简单题

#include <iostream>

#include <cstdlib>

#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;



int reverse_num(int a)

{

    char st[50];

    sprintf(st, "%d", a);

    reverse(st, st + strlen(st));

    int ret;

    sscanf(st, "%d", &ret);

    return ret;

}



int main()

{

    int t;

    scanf("%d", &t);

    while (t--)

    {

        int a, b;

        scanf("%d%d", &a, &b);

        printf("%d\n", reverse_num(reverse_num(a) + reverse_num(b)));

    }

    return 0;

}
View Code

 

你可能感兴趣的:(poj)