| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
似乎根本不是高精度运算,简单地调转数字作加法就可以了#include <stdio.h>
#include <string.h>
int reverse(int n)
{
char str[100];
int i = 0;
while(n)
{
str[i++] = n % 10 + '0';
n /= 10;
}
str[i] = 0;
sscanf(str, "%d", &n);
return n;
}
int main()
{
int T, a, b;
scanf("%d", &T);
while(T--)
{
scanf("%d%d", &a, &b);
printf("%d\n", reverse(reverse(a) + reverse(b)));
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator