| ||||||||||
| 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 | |||||||||
Re:第一次DP做题,秒过,爽In Reply To:Re:第一次DP做题,秒过,爽 Posted by:feather at 2008-06-22 02:16:37 > val[0][0]=res[0][0];
>
> for(i=1;i<n;i++)
> {
> for(j=0;j<i+1;j++)
> {
> if(j==0)
> val[i][0]=val[i-1][0]+res[i][0];
> else if(j==i)
> val[i][i]=val[i-1][i-1]+res[i][i];
> else
> {
> if(val[i-1][j-1]>=val[i-1][j])
> val[i][j]=val[i-1][j-1]+res[i][j];
> else
> val[i][j]=(val[i-1][j]+res[i][j]);
> }
> }
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator