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

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

Posted by twf at 2008-02-26 14:09:44 on Problem 1161
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