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

大牛帮忙,想了好久认为是对的,但结果却相反,为什么?

Posted by e456 at 2006-07-23 18:47:34 on Problem 1163
#include <iostream>
using namespace std;
int d[101][101]={0};
void main()
{
	int n;
	cin>>n;
	int i,j;
	for (i=0;i<n;i++)
		for (j=0;j<=i;j++)
			cin>>d[j][i];
	for (i=n-1;i>0;i--)
		for (j=0;j<i;j++)
			d[i-1][j]+=d[i][j]>d[i][j+1]?d[i][j]:d[i][j+1];
	cout<<d[0][0]<<endl;
}

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