poj 3660 Cow Contest
来源:互联网 发布:ubuntu root登陆ssh 编辑:程序博客网 时间:2024/06/02 00:06
解题思路:这道题是一道关于floyd的图论题。题目的意思是说有n头牛比赛,m种比赛结果,最后问你一共有多少头牛的排名被确定了,其中如果a战胜b,b战胜c,则也可以说a战胜c,即可以传递胜负。
代码:
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<queue>
using namespace std;
const intMAX=105;
const int INF=0xffffff;
int n,m,map[MAX][MAX];
voidFloyd()
{
}
voidPrin()
{
}
intmain()
{
// 1表示打败,-1表示被打败
cin>>a>>b;
map[a][b]=1;
map[b][a]=-1;
}
Floyd();
Prin();
return 0;
}
网上另一种解法:【算法分析】如果A赢了B,那么连边[A,B],然后传递闭包。最后,如果某只牛的出度+入度=n-1的话,它的排名就已经确定了。
利用出度入度,其实我感觉解法差不多,我的解法只是没有直接体现出度入度
代码:代码好短啊!!!!
#include <iostream>
using namespace std;
int f[101][101],n,m;
int main(){
}
- poj 3660 Cow Contest
- POJ 3660 Cow Contest(关系闭包…
- poj 2184 Cow Exhibition
- poj 2187 Beauty Contest
- POJ 3278 Catch That Cow
- poj 1946 Cow Cycl…
- poj 2488
- dp 3267 The Cow Lexicon
- POJ 2485 Highways
-  
- POJ 3299
- poj 1905
-
- poj 3267 The Cow Lexicon(DP)
- HDOJ 2717 Catch That Cow
- POJ 2247 Humble Numbers
- POJ 1753 Flip Game
- POJ 1182 食物链
- poj 数论 1845
- VS 2008 无法解析_in_, _in_opt_的错误
- poj 3661 running
- 01.反汇编笔记
- poj 3665 icow
- poj 3660 Cow Contest
- poj 3273 Monthly Expense
- poj 1905
- poj 3122 pie
- 淡淡的失落,我的ACM之路
- poj 1061 青蛙的约会
- poj 2891
- poj 1067 威佐夫博弈
- 学习了LINUX下用C语言遍历文件夹,一些心得