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 19891206 at 2010-10-10 20:02:53 on Problem 1163
#include<iostream>
using namespace std;
#define Max 10
int Twobig(int a,int b)
{
    if(a<b) return b;
    else return a;
}
int main()
{
    int N,i,j,sum=0;
    int a[Max][Max]={0};
    cin>>N;
    for(i=0;i<N;i++)
       for(j=0;j<i+1;j++)
       cin>>a[i][j];
     for(i=N-2;i>=0;i--)
     {
       for(j=0;j<i+1;j++)
       {
       a[i][j]=a[i][j]+Twobig(a[i+1][j],a[i+1][j+1]);
       if(sum<a[i][j])  sum=a[i][j];
       }
     }
     cout<<sum<<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