| ||||||||||
| 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的状态转移方程
for(i=1;i<f;i++)
for(j=0;j<v;j++)
{
int max=-99999999;
for(k=0;k<j;k++)
if(sum[i-1][k]+a[i][j]>max)
max=sum[i-1][k]+a[i][j];
sum[i][j]=max;
}
其中的代码含义很明显,各位若有麻烦了,可以参考一下,呵呵 ~~
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator