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

Accepted 1132K 1344MS C++ 298B

Posted by wenhua2199 at 2009-08-23 00:22:19 on Problem 2602
#include <iostream>
char a[1000002]={0};
int main()
{
	int n,i;
	int x,y;
	scanf("%d",&n);
	a[n+1]='\0';
	for(i=1;i<=n;i++)
	{
		scanf("%d%d",&x,&y);
		a[i]=x+y+'0';
	}
	for(i=n;i>=1;i--)
	{
		a[i-1]+=(a[i]-'0')/10;
		a[i]=(a[i]-'0')%10+'0';
	}
	printf("%s\n",a+1);
	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