| ||||||||||
| 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核心代码~注意DP的初始化int work(int x,int y)
{
if(x>n || y>m)
return 0;
if(dp[x][y]>mini)
return dp[x][y];
for(int j=y;j<=m-n+x;j++) //枚举列数的范围
{
dp[x][y]=max(dp[x][y],a[x][j]+work(x+1,j+1));
}
return dp[x][y];
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator