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

为什么同样的代码一次 rantime error 一次ac了呢?

Posted by anyunhua at 2007-07-06 16:25:26 on Problem 2602
#include<iostream.h>
char a[1000001][3],b[1000001];
int main()
{
	long int n,i,j,sum=0;

	cin>>n;
	for (i=0;i<n;i++)
	{
		for (j=0;j<2;j++)
			cin>>a[i][j];
	}
	
	for (i=n-1;i>=0;i--)
	{
		sum=a[i][0]-'0'+a[i][1]-'0';
		if(sum<10)
			b[i]=sum+'0';
		else
		{
			b[i]=(sum)%10+'0';
			
			a[i-1][0]+=1;
		}

	}
	for (i=0;i<n;i++)
		cout<<b[i];

	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