随笔分类 - 图论
摘要:/*Invitation CardsTime Limit: 8000MS Memory Limit: 262144KTotal Submissions: 15101 Accepted: 4897DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all,...
阅读全文
摘要:Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 51193 Accepted Submission(s): 13775Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to...
阅读全文
摘要:/*六度分离Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2661 Accepted Submission(s): 1035Problem Description1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six .
阅读全文
摘要:/*一个人的旅行Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10787 Accepted Submission(s): 3674Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上...
阅读全文
摘要:/*微软招聘信息(主要针对已经有工作经验的) 还是畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15993 Accepted...
阅读全文
摘要:/*Agri-NetTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 29678 Accepted: 11767 Description Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John ord...
阅读全文
摘要:Online Judge Problem Set Authors Online Contests User Web BoardHome PageF.A.QsStatistical Charts ProblemsSubmit ProblemOnline StatusProb.ID: RegisterU...
阅读全文
摘要:Red and BlackTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 17584 Accepted: 9279 DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But h..
阅读全文
摘要:#include<iostream>using namespace std;#define maxvex 100typedef struct{ int a[maxvex][maxvex]; int vex;}Graph;int visiteded[maxvex];void DFS(Graph G,int v){ printf("v%d ",v+1); visiteded[v]=1; for(int j=0;j<G.vex;j++) if(G.a[v][j]==1&&visiteded[j]==0) DFS(G,j);}void ...
阅读全文
摘要://graph.h头文件typedef int InfoType;#define MAXV 100//最大顶点个数//定义邻接矩阵类型typedef struct{ int no;//顶点标号 InfoType info;//顶点其他信息,这里用于存放权值}VertexType;//顶点类型typedef struct//图的定义{ int edges[MAXV][MAXV];//邻接矩阵 int n,e;//顶点数,弧数 VertexType vexs[MAXV];//存放顶点信息}MGraph;//图的邻接矩阵类型//以下定义邻接表类型typedef stru...
阅读全文
摘要:此算法可以求任意两点的最短距离,其中边权值可以为负数,而dijkstra只能是固定的点间的距离,并且边全值不能为负数。保存的是后面的点(更好)#include#include#includeusing namespace std;#define N 100#define MAX 1000000int...
阅读全文
摘要:Dijkstra(迪杰斯特拉)算法是典型的最短路径路由算法,用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。Dijkstra算法能得出最短路径的最优解,但由于它遍历计算的节点很多,所以效率低。 Dijkstra算法是很有代表性的最短路算法,在很多...
阅读全文
浙公网安备 33010602011771号