| ||||||||||
| 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 | |||||||||
测试数据正确,为什么不能通过?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator