摘要: 第1题 绿组. 奶牛接力赛[relay]题目描述 农夫约翰已经为一次赛跑选出了K(2≤K≤40)头牛组成了一支接力队.赛跑在农夫约翰所拥有的农场上进行,农场的编号为1到Ⅳf4≤Ⅳ<800),Ⅳ个农场之间共有M(1≤M≤4000)条双向道路,每条双向道路连接一对不同的农场,一对不同的农场之间最多只有一条双向道路.你将得到每条牛为了穿过每个道路所需要的时间.比赛的起点设在1号农场,终虑设在Ⅳ号农场,比赛开始后第一头牛开始从1号农场出发,在Ⅳ号农场到达终点.第一头牛结束之后马上就让下一头牛从1号农场开始,跑向Ⅳ号农场,直到所有的牛都跑过一次为止. 作为比赛的规则,任意的2头牛跑过的路线不能完. 阅读全文
posted @ 2014-03-16 17:10 forever97 阅读(946) 评论(0) 推荐(0) 编辑
摘要: 题解:最小生成树#include #include using namespace std;struct node{int a,b,l;}seg[25005];int T,z,x,t,f[505],m,n,k; char c;int sf(int x){return f[x]==x?x:f[x]=sf(f[x]);}bool cmp(node a,node b){return a.l'9');x=c-'0'; while(c=getchar(),c>='0'&&c<='9')x=x*10+c-' 阅读全文
posted @ 2014-03-16 15:29 forever97 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题解:最小生成树…………#include #include using namespace std;struct node{int a,b,l;}seg[900];int f[27],m,n,a,b; char c;int sf(int x){return f[x]==x?x:f[x]=sf(f[x]);}bool cmp(node a,node b){return a.l'Z');x=c-'A';}void scan(int &x){ while(c=getchar(),c'9');x=c-'0'; while(c=ge 阅读全文
posted @ 2014-03-16 14:14 forever97 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题解:最小生成树#include #include using namespace std;struct node{int a,b,l;}seg[10000];int f[105],m,n,flag; char c;int sf(int x){return f[x]==x?x:f[x]=sf(f[x]);}bool cmp(node a,node b){return a.l'9');x=c-'0'; while(c=getchar(),c>='0'&&c<='9')x=x*10+c-'0' 阅读全文
posted @ 2014-03-16 13:53 forever97 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题解:最小生成树#include #include using namespace std;struct node{int a,b,l;}seg[10000];int f[105],m,n; char c;int sf(int x){return f[x]==x?x:f[x]=sf(f[x]);}bool cmp(node a,node b){return a.l'9');x=c-'0'; while(c=getchar(),c>='0'&&c<='9')x=x*10+c-'0';}in 阅读全文
posted @ 2014-03-16 13:43 forever97 阅读(141) 评论(0) 推荐(0) 编辑