With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas s...
分类:
其他好文 时间:
2015-02-15 16:27:05
阅读次数:
168
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA traveler's map gives the distances between cities along the highways, together with the co...
分类:
其他好文 时间:
2015-02-14 16:12:22
阅读次数:
154
题目1437:To Fill or Not to Fill时间限制:1 秒内存限制:128 兆特殊判题:否提交:1488解决:345题目描述:With highways available, driving a car from Hangzhou to any other city is easy....
分类:
其他好文 时间:
2015-02-13 19:50:13
阅读次数:
183
根据对称性只考虑 \ 的斜线
枚举 \ 所在的边框的大小 a,b 只有在 gcd(a,b) 不为1的情况下才是不重复的直线
有(n-a)*(m-b)个, 如果边框的左上点接着一个边框的右下点则是重复的直线 需要减去 max(n-2*a,0)*max(m-2*b,0)个重复的边框
所以对于一个边长为a,b的边框来说 有 (n-a)*(m-b) - max(n-2*a,0)*max(m-2*b,...
分类:
其他好文 时间:
2015-02-03 17:16:59
阅读次数:
217
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c...
分类:
其他好文 时间:
2015-01-30 08:59:03
阅读次数:
151
104. Highways
Problem code: HIGH
In some countries building highways takes a lot of time... Maybe that's because there are many possiblities to construct a network of highways and engineers can't ...
分类:
其他好文 时间:
2015-01-27 15:03:25
阅读次数:
122
题目大意:岛上要建高铁,有N个站点,给你一个图,表示这N个站点每个站点之间的距离,
要求建造的高铁路线能连接所有的站点,并且使总的路程最短。求出满足情况的路线中两个站
点间最长的路。
思路:根据要求求出最小生成树,并求出最小生成树上的最大边,就是最终答案。...
分类:
其他好文 时间:
2015-01-24 21:28:44
阅读次数:
193
题目链接:
1751
题意:
一个平面图中有N个城镇,标号1~N,给出这N个城镇的坐标,并给出一些已经建设好的公路,问要完成最小生成树还需要建设哪些公路。
题解 :
prim:用邻接矩阵保存所有城镇之间的距离,已建好的距离则为0;建立一个pre数组
表示当前城镇的(在最小生成树中的)前一个城镇,开始初始化为1,在更新low...
分类:
其他好文 时间:
2015-01-24 17:30:22
阅读次数:
146
#include "iostream"
#include "memory.h"
#include "cstdio"
using namespace std;
int grap[500][500];
int ans;
int dis[500];
bool visited[500];
void prime(int n){
int source = 1;
for (int i = 1; i <=...
分类:
其他好文 时间:
2015-01-13 21:39:05
阅读次数:
153
题意:给出一个n行m列的点阵,求共有多少条非水平非竖直线至少经过其中两点。分析:首先说紫书上的思路,编程较简单且容易理解。由于对称性,所以只统计“\”这种线型的,最后乘2即是答案。枚举斜线包围盒的大小,如果盒子的长宽ab互质,则是可以的。这种盒子共有(m-a)(n-b)个,但要减去其中重复的。如果有...
分类:
其他好文 时间:
2015-01-03 17:10:50
阅读次数:
180