11 2013 档案
摘要:思路:blleman—ford检验负回路代码:#include#include#includeusing namespace std;struct infor{ int from; int to; double r; double c;};infor es[20008];double dis[200],v;int enu,n,s;bool bellman(){ memset(dis,0,sizeof(dis)); dis[s]=v; for(int i=0;i>n>>m>>s>>v; for(int i=0;i>a>>b>>
阅读全文
摘要:思路:bellman-ford检验正回路代码:#include#include#includeusing namespace std;struct infor{ int from; int to; double r; double c;};infor es[20008];double dis[200],v;int enu,n,s;bool bellman(){ memset(dis,0,sizeof(dis)); dis[s]=v; for(int i=0;i>n>>m>>s>>v; for(int i=0;i>a>>b>>
阅读全文
摘要:思路:Dijkstra代码:#include#include#include#includeusing namespace std;struct infor{ int x; int y;};int t,n=0;infor stone[202];double d(int x,int y){ return sqrt(x*x+y*y);}double dis[201];double map[202][202];bool visit[202];using namespace std;void dijkstra(){ while(true){ double m=10...
阅读全文
摘要:#include#include#includeusing namespace std;struct edge{ int from,to,cost;};struct vertex{ int value,rank;};const int Max=110;const int INF=0x7fffffff;edge es[Max*Max];vertex v[Max];int dist[Max],en=1;int ans=0x7fffffff;void bellman(int n, int m){ int i; dist[0]=0; while(true){ ...
阅读全文

浙公网安备 33010602011771号