POJ2139 Six Degrees of Cowvin Bacon [Floyd]】的更多相关文章

水题,随手敲过 一看就是最短路问题,a,b演同一场电影则他们的距离为1 默认全部两两原始距离无穷,到自身为0 输入全部数据处理后floyd 然后照它说的求平均分离度 再找最小的,×100取整输出 #include <cstdio> #include <algorithm> #include <iostream> using namespace std; int cownum,filmnum; int film[11111][333]; int g[333][333];…
Six Degrees of Cowvin Bacon Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 2   Accepted Submission(s) : 1 Problem Description The cows have been making movies lately, so they are ready to play…
普通的Floyd了分分秒可以水过,结果在submit前删调试段落的时候把程序本体给删了吃了两个WA…… #include<iostream> #include<cstring> #include<cstdio> ; using namespace std; ; int len[MAXN][MAXN]; int f[MAXN][MAXN]; int n,m; int main() { scanf("%d%d",&n,&m); ;i<…
思路: floyd 实现: #include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; ][], n, m, k; const int INF = 0x3f3f3f3f; int main() { memset(a, 0x3f, sizeof(a)); cin >>…
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=78207 看懂题就好. 求某一办公室到其他办公室的最短距离. 多组输入,n表示n条关系,下面n次每次输入 x y d表示x到y的距离是d. 输出办公室的编号和距离. 因为 顶点数小于10,直接floyed求出所有距离之后,枚举出最短距离即可. /* *********************************************** Author : zch Cre…
Six Degrees of Cowvin Bacon Descriptions 数学课上,WNJXYK忽然发现人缘也是可以被量化的,我们用一个人到其他所有人的平均距离来量化计算. 在这里定义人与人的距离:1.自己与自己的距离为02.如果A和B属于同一个小团体,那么他们之间的距离为13.如果A与B属于一个小团体,B与C属于一个小团体,且A与C不同属于任何一个小团体,那么A与C的距离为2(A联系C,经过B.C两个人)4.以此类推 班里有N个人 (2 <= N <= 300),共有M对小团体关系(…
传送门:http://poj.org/problem?id=2139 Six Degrees of Cowvin Bacon Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6709 Accepted: 3122 Description The cows have been making movies lately, so they are ready to play a variant of the famous game…
The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon". The game works like this: each cow is considered to be zero degrees of separation (degrees) away from herself. If two d…
本题链接:http://poj.org/problem?id=2139 Description:     The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon".      The game works like this: each cow is considered to be zero d…
题意:如果两头牛在同一部电影中出现过,那么这两头牛的度就为1, 如果这两头牛a,b没有在同一部电影中出现过,但a,b分别与c在同一部电影中出现过,那么a,b的度为2.以此类推,a与b之间有n头媒介牛,那么a,b的度为n+1. 给出m部电影,每一部给出牛的个数,和牛的编号.问那一头到其他每头牛的度数平均值最小,输出最小平均值乘100 思路:到所有牛的度数的平均值最小,也就是到所有牛的度数总和最小.那么就是找这头牛到其他每头牛的最小度,也就是最短路径,相加再除以(n-1)就是最小平均值.对于如何确定…