Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:大牛帮忙,想了好久认为是对的,但结果却相反,为什么?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; > } for (j=0;j<i;j++) 改为for (j=0;j<=i;j++)试试 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator