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

 

posted @ 2013-06-12 14:59  金海峰  阅读(142)  评论(0编辑  收藏  举报