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 |
哪位高手帮忙看一下,为什么提交错误?我在coldblocks上得到的结果与答案是一样的#include"iostream" #include"memory" using namespace std; int max(int x,int y) { if(x>y) return x; return y; } int main() { int i,j ,n; int a[351][351]; memset(a,0,sizeof(a)); cin>>n; cout<<"\n"; for(i=1;i<=n;i++) { for(j=1;j<=i;j++) cin>>a[i][j]; cout<<"\n"; } for(i=n;i>1;i--) for(j=1;j<=i;j++) a[i-1][j]=a[i-1][j]+max(a[i][j],a[i][j+1]); cout<<a[1][1]<<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator