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

奇怪,dev c++ 编译不过,vc 却可以??大虾看看!!

Posted by sailors at 2007-08-26 17:40:37
#include<iostream>
using namespace std;

int a[110][110];
int max;
int n;
int dfs(int k)
{
	int temp;
	if(k==n+1)return 0;
	int i;
	for(i=1;i<=k;i++)
	{
		temp=a[k][i]+dfs(k+1);
		
		if(temp>max)
		{
			max=temp;
		}
	}
	return 0;
}
int main()
{
	int i,j;
	while(cin>>n)
	{
		max=0;
		for(i=1;i<=n;i++)
		{
			for(j=1;j<=i;j++)
			{
				cin>>a[i][j];
			}
		}
		dfs(n);
		cout<<max<<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