首页 > 编程知识 正文

frank wolfe算法交通分配,dijkstra算法的实际应用

时间:2023-05-04 00:05:40 阅读:166879 作者:2445

还原加载网络(中石油6610 ) )。

弗洛伊德算法的使用。

#include iostream

using namespace std;

const int N=305;

int arr[N][N];

const int inf=1e9 10;

int main () )

{

int n;

wile(Cinn ) )。

{

for(intI=1; i=n; I )

for(intj=1; j=n; j )

{

cinarr[i][j];

}

for(intI=1; i=n; I )

龙龙sum=0;

for(intI=1; i=n; I )

for(intj=1; j=n; j )

for(inttemp=1; temp=n; temp )

{

intselect=(arr [ I ] [ temp ]==INF|| arr [ temp ] [ j ]==INF )? INF : (arr [ I ] [ temp ] arr [ temp ] [ j ] );

if(selectarr[I][j]arr[I][j]!=inf )

{

计数'-1 ' endl;

goto x;

}

//else if () )

}

for(intj=1; j=n; j )

for(intI=j1; i=n; I )

{

输入标志=0;

for(inttemp=1; temp=n; temp )

{

intselect=(arr [ I ] [ temp ]==INF|| arr [ temp ] [ j ]==INF )? INF : (arr [ I ] [ temp ] arr [ temp ] [ j ] );

if(select==arr[I][j] ) )

flag=1;

}

if(flag==0) )。

sum=sum arr[i][j];

}

coutsumendl;

x:

}

返回0;

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。