2012年4月12日
摘要: /* Name: 位运算应用 Copyright: Author: Try_86 Date: 12/04/12 22:24 Description: */#include <cstdio>#include <iostream>using namespace std;int main() { int a; while (scanf("%d", &a), a) printf ("%d\n", a&(a^(a-1))); return 0;} 阅读全文
posted @ 2012-04-12 22:27 Try86 阅读(153) 评论(0) 推荐(0)
摘要: /* Name: 最短路(dijkstra邻接矩阵)+hash判重并统计顶点数+二分查找返回顶点位置 Copyright: Author: Try_86 Date: 12/04/12 20:57 Description: 注意:起始点和终点不在给出的路线中的情况!!! */#include <cstdio>#include <cstdlib>#include <cstring>#include <iostream>using namespace std;const int S = 163; const int N = 155;const int 阅读全文
posted @ 2012-04-12 21:15 Try86 阅读(196) 评论(0) 推荐(0)
摘要: /* Name: 最短路(dijkstra邻接矩阵) Copyright: Author: Try_86 Date: 12/04/12 18:09 Description: */#include <cstdio>#include <cstring>#include <iostream>using namespace std;const int N = 105; const int MAX = 1000000000;//定义无穷大 bool vis[N];int map[N][N], dis[N];void init(int vs) {//初始化 for (i 阅读全文
posted @ 2012-04-12 18:21 Try86 阅读(190) 评论(0) 推荐(0)
摘要: /* Name: 最短路(bellmanFord) Copyright: Author: Try_86 Date: 12/04/12 12:42 Description: 对每个起始点运行一次bellmanFord,求最短路 */#include <cstdio>#include <iostream>using namespace std;const int N = 1005;const int M = 500500;const int MAX = 1000000000;int dis[N], ss[N], ds[N];struct edge { int u; int. 阅读全文
posted @ 2012-04-12 12:47 Try86 阅读(250) 评论(0) 推荐(0)