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

为什么 2602 get Runtime error?

Posted by happyi94 at 2008-05-26 16:02:54
为什么 2602 get Runtime error?

#include<stdio.h>

int N;
int digit[2][1000000];
int MAX[100000];

void input()
{
	int i;
	scanf("%d",&N);
	for(i=N-1; i>=0; i--){
		scanf("%d%d",&digit[0][i],&digit[1][i]);
	}
}

void process()
{
	int i;
	for(i=0; i<N; i++){
		MAX[i]=digit[0][i]+digit[1][i];
		if(MAX[i]>=10) digit[0][i+1]++;
		MAX[i]=MAX[i]%10;
	}
}

void output()
{
	int i;
	if(MAX[N]==1) printf("%d",MAX[N]);
	for(i=N-1; i>=0; i--){
		printf("%d",MAX[i]);
	}
}

int main()
{
	input();
	process();
	output();
	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