| ||||||||||
| 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:请问状态转移方程是怎样的?In Reply To:请问状态转移方程是怎样的? Posted by:felips at 2007-04-16 20:32:27 > 我的如下:
> d(i,j) 表示坐第i次飞机,到达城市j的最小费用
> d(1,j)=price[1][j][1]; //第一个航班
> d(i,j)=min{d(i-1,l)+price[l][j][i%day[l][j]]} //第i个航班
> 最后d(k,n)就是答案,Sample都过了
> 可是提交WA
In the min funtion, you must check whether d(i-1,l) and price[l][j][i%day[l][j]] are difference 0. If all of l cities don't have any flight so the d(i,j) will be 0. it's possible if d(k,n)<>0.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator