中文题,不翻译不解释。
#include#include using namespace std; const int MAX=120; int M,N,X,T,V; int map[MAX][MAX]; int topo[MAX]; int visted[MAX]; typedef struct NODE { int level; int price; }NODE; NODE nodes[MAX]; int num=0; void Dfs(int v) { visted[v]=1; for (int i=1;i<=N;i++) { if (!visted[i] && map[v][i]>0)//unvisited { Dfs(i); } } topo[num++]=v; } void MinCost() { int i,j; for (i=0;i 0) { int temp=nodes[topo[i]].price+map[topo[j]][topo[i]]; if ((temp M ) { for(j=1;j