poj 1258 Agri-Net(Prim)(基础)】的更多相关文章

( ̄▽ ̄)" #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> #include<string> #include<cstdlib> #include<vector> using namespace std; typedef long long ll; const int…
Agri-Net Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 41230   Accepted: 16810 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He nee…
题意:n个农场,求把所有农场连接起来所需要最短的距离. 思路:prim算法 课本代码: //prim算法 #include<iostream> #include<stdio.h> #include<cstring> using namespace std; int n; int tot; int v[150][150]; int dist[150];//存 节点到树 的最小距离 bool use[150];//标记节点是否存在 int main(){ while(sca…
Agri-Net Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39820   Accepted: 16192 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He nee…
Agri-Net Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 45050   Accepted: 18479 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He nee…
Agri-Net Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) Total Submission(s) : 1   Accepted Submission(s) : 1 Problem Description Farmer John has been elected mayor of his town! One of his campaign promises was to bri…
#include <iostream>// poj 1258 10.1.5.253 1505 using namespace std; #define N 105 // 顶点的最大个数 (多写 int a[N][N],low[N],n,ans; int min(int x,int y) { return x<y?x:y; } void prim(int u0) { int i,j,m,k; ans=0; // for (i=1;i<n;i++) low[i]=a[u0][i]; /…
poj 1251  && hdu 1301 Sample Input 9 //n 结点数A 2 B 12 I 25B 3 C 10 H 40 I 8C 2 D 18 G 55D 1 E 44E 2 F 60 G 38F 0G 1 H 35H 1 I 353A 2 B 10 C 40B 1 C 200Sample Output 21630 prim算法 # include <iostream> # include <cstdio> # include <cstr…
POJ 1258 Agri-Net http://poj.org/problem?id=1258 水题. 题目就是让你求MST,连矩阵都给你了. prim版 #include<cstdio> const int MAXN=101; const int INF=100000+10; int map[MAXN][MAXN]; int dis[MAXN]; int n; void prim() { bool vis[MAXN]={0}; for(int i=0;i<=n;i++) dis[i]…
Agri-Net Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 44487   Accepted: 18173 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He nee…