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 |
第一个自己独立解决的DP问题,不容易啊,说说思路从一维数组括展到二维数组 一维数组: #define min -999999 sum=0; maxsum=min; for(b=j=0;j<N;j++) { scanf("%d",&x); sum+=x; if(sum>maxsum) { maxsum=sum; start=b; end=j; } if(sum<0) { sum=0; b=j+1; } 本题二维数组,可以分成有i行(i从1到n) 再根据一维数组做 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator