| ||||||||||
| 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 | |||||||||
此题用枚举+动态规划的方法。此题用枚举的方法把二维的问题转化成一位的问题,再运用动态规划的方法解决,该算法的时间复杂度为O(N^3)。
动态规划的核心代码(部分):
tmp=0;
for(k=1;k<=n;k++)
{
if(tmp>=0) tmp+=sum[k];
else tmp=sum[k];
if(ans<tmp) ans=tmp;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator