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

why g++ Runtime Error, 总是有时候G++ RE,但c++ ac,想弄清楚。谢希

Posted by Lucifer at 2005-09-22 20:28:18 on Problem 2602
#include <stdio.h>
#define MAX 1000010
int main()
{
	#ifndef ONLINE_JUDGE
		freopen("in.txt","r",stdin);
	#endif
	__int64 n,i;
         short a[MAX],b[MAX],c[MAX];
	scanf("%ld",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%ld %ld",&a[i],&b[i]);
		c[i]=0;
	}
	for (i=n;i>=1;i--)
	{
		c[i]+=a[i]+b[i];
		if (c[i]>9)
		{
			c[i-1]++;
			c[i]%=10;
		}
	}
	for (i=1;i<=n;i++) printf("%ld",c[i]);
	printf("\n");
}

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