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

Re:谁解析下, 这两个循环到底怎么不一样?

Posted by hairlun at 2008-07-09 10:16:17 on Problem 1161
In Reply To:谁解析下, 这两个循环到底怎么不一样? Posted by:twf at 2008-02-26 14:09:44
> for (int s = 0; s < V; s++)
>       for (int t = 0; t < V; t++)
>         {
>           if (s == t) continue;
>           for (int i = 0; i < V; i++)
>             {
>               if (dist[s][i] + dist[i][t] < dist[s][t])
>                 dist[s][t] = dist[s][i] + dist[i][t];
>             }
>         }
> 
> 
> 
> 
> 
>     for (int i = 0; i < V; i++)  //中间点应该在最内层循环枚举
>       for (int s = 0; s < V; s++)
>           for (int t = 0; t < V; t++)
>             if (s != t)
>               if (dist[s][t] > dist[s][i] + dist[i][t])
>                 dist[s][t] = dist[s][i] + dist[i][t];    
>     

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