Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

似乎根本不是高精度运算,简单地调转数字作加法就可以了

Posted by systemman at 2008-07-07 12:00:42 on Problem 1504
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator