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 |
感觉POJ系统出故障了#include<stdio.h> #include<stdlib.h> int main() { int num[100],N,mx=0,MAX[100],m[100]; int i,j; scanf("%i",&N); if(N<=1||N>100)return 0; for(i=1;i<=N;i++) { for(j=0;j<i;j++) { scanf("%i",&num[j]); if(num[j]<0||num[j]>99)return 0; } for(j=0;j<i;j++) { MAX[j]=m[j]; m[j]=num[j]+max(MAX[j],((j>=1)?MAX[j-1]:0)); } } for(i=0;i<N;i++) mx=max(mx,m[i]); printf("%i",mx); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator