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:求0MS代码In Reply To:求0MS代码 Posted by:adps2010_09274014 at 2010-07-31 19:36:00 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { int a[105][105]; int n,x; while(scanf("%d",&n)!=EOF) { int big=0; memset(a,0,sizeof(a)); for(int i=1;i<=n;i++) for(int j=1;j<=i;j++) { cin>>x; a[i][j]=max(a[i-1][j-1]+x,a[i-1][j]+x); } for(int i=1;i<=n;i++) if(a[n][i]>big) big=a[n][i]; cout<<big<<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