摘要: 题目描述给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历)输入输入第一行为整数n(0 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 int map[105][105]; 9 int visited[105];10 int mark=1;11 int i,root,bian;12 13 queue q;14 15 void bfs(int h,int bian)16 {17 memset(vi... 阅读全文
posted @ 2013-08-12 15:50 WangLC 阅读(737) 评论(0) 推荐(0)
摘要: Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same nu 阅读全文
posted @ 2013-08-12 10:16 WangLC 阅读(272) 评论(0) 推荐(0)