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

感觉POJ系统出故障了

Posted by plich at 2006-11-04 16:28:26 on Problem 1163
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int num[100],N,mx=0,MAX[100],m[100];
	int i,j;
	scanf("%i",&N);
	if(N<=1||N>100)return 0;
	for(i=1;i<=N;i++)
	{
		for(j=0;j<i;j++)
		{
			scanf("%i",&num[j]);
			if(num[j]<0||num[j]>99)return 0;
		}
		for(j=0;j<i;j++)
		{
			MAX[j]=m[j];
			m[j]=num[j]+max(MAX[j],((j>=1)?MAX[j-1]:0));
		}
	
	}
	for(i=0;i<N;i++)
		mx=max(mx,m[i]);
	printf("%i",mx);
	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