摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544简单的最短路径问题,用Djikstra即可解决!代码如下:#include <cstdio>#include <cstring>using namespace std;const int MAX = 101;const int INF = 1000000001;int map[MAX][MAX];int visited[MAX];int dist[MAX];int djikstra(int v, int n);int main(){ int n, m; int i; . 阅读全文
摘要:
题目链接如下:http://acm.hdu.edu.cn/showproblem.php?pid=3790这题用最短路径Djikstra就可以解决,用Floyd会超时!代码如下:#include <iostream>using namespace std;const int INF = 999999999;const int N = 1001;struct{ int distance; int price; } map[N][N];int dist[N];int price[N];int visited[N];void djikstra(int s, ... 阅读全文