Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

ans的两个下标是节点id和用的money吗?

Posted by 00448264 at 2005-05-18 17:51:05 on Problem 1724
In Reply To:似乎很接近阿,我的是这样的 Posted by:TN at 2005-05-18 17:48:32
> int bfs()
> {
>     int i,j,p,qlen,qnow,end;
>     state now,ns;
>     init.node=1;init.cost=0;init.dis=0;len=0;
>     insert(init);ans[1][0]=0;
>     while (len>=1)
>     {
>         now=pop();
>         if (now.node==n) return (now.dis);
>         for (i=1;i<=num[now.node];i++)
>         {
>            end=des[now.node][i];
>            ns.node=end;
>            ns.dis=now.dis+dis[now.node][i];
>            ns.cost=now.cost+cost[now.node][i];
>            if (ns.cost<=k)
>            if (ns.dis<ans[end][ns.cost])
>            {
>               ans[end][ns.cost]=ns.dis;
>               insert(ns);
>            }    
>         }    
>     }    
>     return -1;         
> }    

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator