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:大牛帮忙,想了好久认为是对的,但结果却相反,为什么?

Posted by littlefool at 2009-04-04 13:48:26 on Problem 1163
In Reply To:大牛帮忙,想了好久认为是对的,但结果却相反,为什么? Posted by:e456 at 2006-07-23 18:47:34
> #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;
> }
晕死了,折腾了大半小时,终于发现,你的输入错了。是cin>>d[i][j]不是d[j][i]

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