2008浙大研究生复试热身赛_Floyd_Dijkstra_hdoj1874

http://acm.hdu.edu.cn/showproblem.php?pid=1874

Floyd:

Problem : 1874 ( 畅通工程续 )     Judge Status : Accepted
RunId : 18936951    Language : G++    Author : 311309030328
Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
//HDU 1874
#include 
#include
#include

#define MAXN 220
#define INF 0xfffffff

int edge[MAXN][MAXN];
int n,m,s,t;

int Floyd()
{
    int i,j,k;

    for(k=0;kedge[i][k]+edge[k][j])
                {
                    edge[i][j]=edge[i][k]+edge[k][j];                    
                }
            }
        }
    }    
    return edge[s][t]

DIjkstra:

Problem : 1874 ( 畅通工程续 )     Judge Status : Accepted
RunId : 18936947    Language : G++    Author : 311309030328
Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
//HDU 1874
#include 
#include 
#include 
#define INF 0xffffff
#define MAXN 220

int dist[MAXN];
int edge[MAXN][MAXN];
int visit[MAXN];
int n,m,s,t;
int Dijkstra()
{
    
    int i,j,k,min;
    for(i=0;i


你可能感兴趣的:(DataStructure)