F - Truck History - poj 1789】的更多相关文章

有一个汽车公司有很多年的汽车制造历史,所以他们会有很多的车型,现在有一些历史学者来研究他们的历史,发现他们的汽车编号很有意思都是有7个小写字母组成的,而且这些小写字母具有一些特别的意义,比如说一个汽车是有另外一个汽车演变过来的,他们的字母差了有几个不同的,就说明演变多少年(最多也就7年!!),现在就是求这些汽车的总演变史最少有多少时间. 分析:考虑到是个完全图,应该使用prim算法,因为prim是按照点来的,不过还是喜欢krusal,试一下看看能不能过.. *******************…
链接: http://poj.org/problem?id=1789 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 22133   Accepted: 8581 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for fu…
  Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 20884   Accepted: 8075 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The compa…
题目链接:https://vjudge.net/problem/POJ-1789 思路: 题目意思就是说,给定一些长度为7的字符串,可以把字符串抽象为一个点, 每个点之间的距离就是他们本身字符串与其他字符串字符不同的个数. 之后就是一个最小生成树的板子. #include <stdio.h> #include <iostream> #include <queue> using namespace std; ; const int inf = (int)1e9; ]; i…
#include<iostream> #include<cstring> #include<algorithm> #include<stdio.h> using namespace std; const int INF=0x3f3f3f3f; ; int n; int p[N]; ]; ; struct edge{ int a,b; int w; }e[N*N]; bool cmp(edge a,edge b) { return a.w<b.w; }…
F - Truck History #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 2010 using namespace std; int fa[MAXN]; int n,ans,tot; ]; struct nond{ int x,y,z; }v[MAXN*MAXN]; int cmp(nond a,nond b){ retur…
链接:Truck History - POJ 1789 - Virtual Judge  https://vjudge.net/problem/POJ-1789 题意:先给出一个n,代表接下来字符串的个数,接下来n个字符串,每个字符串长度为7,没有完全相同的字符串,字符串之间的距离是两个字符串里不同字符的个数(相同位置两两对比),然后求出从某个点到其他点距离和的最小值(分子一直是1,Q越小,1/Q越大),其实就是叫我们求出最小生成树,先字符串两两相比建图,然后求最小生成树. #include<i…
题目连接 http://poj.org/problem?id=1789 Truck History Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each…
id=1789">Truck History Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17610   Accepted: 6786 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture,…
链接: http://poj.org/problem?id=1789 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/G Truck History Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 14950   Accepted: 5714 Description Advanced Cargo Movement, Ltd. uses…