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

Re:求0MS代码

Posted by zhongdi at 2012-07-20 11:29:12 on Problem 1163
In Reply To:求0MS代码 Posted by:adps2010_09274014 at 2010-07-31 19:36:00
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int a[105][105];
	int n,x;
	while(scanf("%d",&n)!=EOF)
	{
		int big=0;
		memset(a,0,sizeof(a));
		for(int i=1;i<=n;i++)
			for(int j=1;j<=i;j++)
			{
				cin>>x;
				a[i][j]=max(a[i-1][j-1]+x,a[i-1][j]+x);
			}
		for(int i=1;i<=n;i++)
			if(a[n][i]>big) big=a[n][i];
		cout<<big<<endl;
	}
	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