摘要: //拓扑排序的经典题目//此题切忌:无法排序的情况下也可能出现环的情况#include <iostream>#include <string>using namespace std;#define arraysize 30int map[arraysize][arraysize];//存储邻接阵int indegree[arraysize];//存储节点入度char res... 阅读全文
posted @ 2010-05-21 11:36 北海小龙 阅读(282) 评论(0) 推荐(0)
摘要: //贪心看完后在看看此题//题目分类:拓扑排序+贪心拓扑排序参考:(1)http://www.answeror.com/archives/23913(2)http://hi.baidu.com/lewutian/blog/item/90803c6ed2afe7d181cb4aa8.html/cmtid/5c9feacbc9f19c12bf09e67f总结:(1)题目大意:有N个小球,重量从小大排列... 阅读全文
posted @ 2010-05-21 11:36 北海小龙 阅读(680) 评论(0) 推荐(1)
摘要: //题目类型:贪心中的纯活动安排问题, #include <cstdlib>#include <algorithm>#include <iostream>//#include <conio.h>using namespace std;#define arraysize 101typedef struct time{ int start; int fi... 阅读全文
posted @ 2010-05-21 11:35 北海小龙 阅读(580) 评论(0) 推荐(0)
摘要: //典型的拓扑排序算法(邻接阵形式),可以作为拓扑排序的模板 #include <iostream>//#include <conio.h>using namespace std;#define arraysize 501int map[arraysize][arraysize]; //存储图的临界阵 int n,m;int indegree[arraysize]; //存... 阅读全文
posted @ 2010-05-21 11:35 北海小龙 阅读(677) 评论(0) 推荐(0)
摘要: //杭电 2828 精题//解题思路:深度优先搜索#include <iostream>#include <string>using namespace std;#define arraysize 501int n,m;typedef struct swch//定义开关{ int status;//定义开关的状态 int num;//定义开关的标识}swch;typedef... 阅读全文
posted @ 2010-05-21 11:34 北海小龙 阅读(406) 评论(0) 推荐(0)