模板
模板题整理
子i珮
好好学习
展开
-
HDU1233 还是畅通工程(最小生成树Prim)【模板】
还是畅通工程HEREDescription某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的...原创 2020-02-19 00:05:47 · 77 阅读 · 0 评论 -
POJ3126 Prime Path(BFS+数论)【模板】
Prime PathHEREDescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their off...原创 2020-02-13 17:42:10 · 92 阅读 · 0 评论 -
POJ1679 The Unique MST(次小生成树)【★】
The Unique MSTHEREDescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spa...原创 2020-02-15 17:48:39 · 73 阅读 · 0 评论 -
POJ3278 Catch That Cow(BFS)【模板】
Catch That CowHEREDescriptionFarmer 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 c...原创 2020-02-13 15:48:43 · 77 阅读 · 0 评论 -
POJ1321 棋盘问题(DFS)【模板】
棋盘问题HEREDescription在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。...原创 2020-02-13 15:17:06 · 149 阅读 · 0 评论