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

哪位高手帮忙看一下,为什么提交错误?我在coldblocks上得到的结果与答案是一样的

Posted by chenw675 at 2009-04-04 08:23:42 on Problem 3176
#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:
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