E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Highways
11661 - Burger Time?
Everybody knows that along the more important
highways
there are countless fast food restaurants
·
2015-11-13 08:22
time
poj 1751
highways
用prim能过,用ku...超时 ku... #include<iostream> using namespace std; struct town{ int x; int y; }town[800]; struct dist{ int from; int to; int dis; int vis; }dist[320000]; int cmp(const void *a
·
2015-11-13 05:45
poj
POJ2485——
Highways
Unfortunately, Flatopia has no public
highways
. So the traffic is difficult in Flatopia.
·
2015-11-13 04:39
poj
POJ 2485-
Highways
http://poj.org/problem?id=2485 这是道最小生成树的题目,求的是最小生成树中最大边的权值。开始就想到用kruskal算法去做, 因为边是从小到大排序的,所以保证最后一条加入生成树的边的权值是最小生成树当中最大的。 Kruskal仅排序用的时间是O(mlog m),其中m 为n^2数量级的,为边的总数。 &nbs
·
2015-11-13 03:45
poj
[POJ1751
Highways
]
【题目】:
Highways
【来源】:PKU 1751 【关键字】:图论 最小生成树 //=====================================================
·
2015-11-13 02:04
poj
POJ 2485,
Highways
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6912 Accepted: 3284 DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public h
·
2015-11-13 01:58
poj
Highways
http://poj.org/problem?id=2485 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #define MAXN 2010 5 6 const int INF=1<<28; 7 using namesp
·
2015-11-12 23:46
wa
POJ 1751
Highways
最小生成树的水题,直接的最小生成树算法就可以了。题意给定n个城市,只不过是又给定了已经连接起来的道路,由于输出的是城镇的编号,所以不用计算两城镇之间的真正距离(既不用算sqrt),用的是kruskal,比较费时,估计用prim可以节省不少时间. code #include < iostream > #include < cs
·
2015-11-12 17:56
poj
poj 2485
Highways
用kruskal()算法处理》》。 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define MAXN 300000 4 5 int T, n, h, u[MAXN], v[MAXN], w[MAXN], p[510], r[MAXN]; 6 7 int cmp(const void *_p, c
·
2015-11-12 15:08
poj
POJ 2485
Highways
最小生成树
http://poj.org/problem?id=2485 求最小生成树中权值最大的 这题样例有点奇葩,自己好几种错误理解都能配的上这个样例,囧。 样例中的那个3表示有3行3列 i行j列 i=j 每一个数字表示第i个点和第j个点的连接权值为map[i][j]; 代码不难 1 #include<stdio.h> 2 #
·
2015-11-12 14:47
最小生成树
POJ 2485
Highways
(kruskal 最小生成树)
Highways
POJ 2485so that it will be possible to drive between any pair of towns without leaving the
·
2015-11-12 10:31
最小生成树
【SPOJ 104】
Highways
Highways
Problem code: HIGH In some countries building
highways
takes a lot of time...
·
2015-11-11 17:00
poj
zoj 2048
Highways
ZOJ Problem Set - 2048
Highways
Time Limit: 5 Seconds Memory Limit: 32768
·
2015-11-11 13:16
ZOJ
POJ 2485
Highways
(最小生成树)
题目链接 第一WA,发现读错题了,以为求最大生成树的最小边。。。再次PE,题目中明明说:There is an empty line after each test case.这不是坑人吗?数据中没有换行 还算是比较裸的prim的。。 1 #include <stdio.h> 2 #include <string.h> 3 #define N 100000
·
2015-11-11 10:25
最小生成树
POJ2485
Highways
http://poj.org/problem?id=2485 题意 : 这道题和1258很像,但是这道题求的是最小生成树中最大的那条边,所以在函数里处理一下就行了。 思路 : 赤裸裸的最小生成树啊,但是这道题一定要注意,因为底下有提醒,一定要用scanf输入,结果我就很悲剧的没看到啊,然后一直改一直改,到最后又去看了一遍题才发现要用scanf啊,╮(╯▽╰)╭ 1 #include
·
2015-11-11 10:56
poj
POJ 2485
Highways
解题思路:Prim算法求解最小生成树, #include < iostream > using namespace std; #define MaxNum 1e8 int main(){ int m, n, min, start, tempS, M
·
2015-11-11 04:04
poj
九度OJ 1437 To Fill or Not to Fill -- 贪心算法
pid=1437 题目描述: With
highways
available, driving a car from Hangzhou to any
·
2015-11-11 04:22
贪心算法
Battle Over Cities (25)(DFS、连通图)
It is vitally important to have all the cities connected by
highways
in a war
·
2015-11-11 00:20
over
POJ 1751
Highways
(最小生成树 prim算法)
Highways
Description The island nation of Flatopia
·
2015-11-09 13:37
最小生成树
POJ 2485
Highways
(最小生成树+ 输出该最小生成树里的最长的边权)
&n
·
2015-11-08 16:07
最小生成树
1030. Travel Plan (30)
判题程序 Standard 作者 CHEN, Yue A traveler's map gives the distances between cities along the
highways
·
2015-11-08 15:24
EL
SPOJ 104
Highways
(最小生成树计数)
题目链接:http://www.spoj.pl/problems/HIGH/ 题意:求最小生成树个数。 思路:模板。。。 #include <iostream> #include <cstdio> #include <cstring> #define int64 long long using namespace std;
·
2015-11-08 11:19
最小生成树
POJ 2485
Highways
解题报告
id=2485
Highways
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 
·
2015-11-07 15:57
poj
POJ 1751
Highways
(最小生成树)
Highways
Time Limit:1000MS Memory Limit:10000KB  
·
2015-11-07 14:14
最小生成树
sicily 1090
Highways
最小生成树
题目是求最长的边,在生成最小生成树时,用一个变量保存最大的值即可 //Prim算法 #include <iostream> #include <memory.h> #define INF 1000000 #define MAX 200 using n
·
2015-11-07 13:10
最小生成树
H:
Highways
Unfortunately, Flatopia has no public
highways
. So the traffic is difficult in Flatopia.
·
2015-11-07 12:21
wa
Highways
poj 2485
Unfortunately, Flatopia has no public
highways
. So the traffic is difficult in Flatopia.
·
2015-11-07 11:37
poj
poj 2485
Highways
一道简单的最小生成树问题; View Code #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<map> #
·
2015-11-07 11:59
poj
POJ2485——Prim——
Highways
Unfortunately, Flatopia has no public
highways
. So the traffic is difficult in Flatopia.
·
2015-11-07 10:00
Prim
ZOJ 2048
Highways
N -
Highways
Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit
·
2015-11-02 17:47
ZOJ
poj 2128
Highways
题意:有一条从1~n的单向高速路,现在要你修建两单向路条路,使任何一个点可以到任何的点,求这两天的路最短; 注意:起始中点要不同; 我们知道要满足条件,那么我们就必定使1~n有通路,我们可以从1~n修一条路,在从n-3条边选出最短的边就可以了;这里为什么是从n-3条边里选,这里我们要去掉两个端点的边; 例如:n=4 时 4 7 9,这里答案是12而不是11; View Code
·
2015-11-02 15:07
poj
【贪心】PAT 1033. To Fill or Not to Fill (25)
10 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 ZHANG, Guochuan With
highways
·
2015-11-02 12:41
pat
UVa 1393 (容斥原理、GCD)
Highways
题意: 给出一个n行m列的点阵,求共有多少条非水平非竖直线至少经过其中两点。 分析: 首先说紫书上的思路,编程较简单且容易理解。由于对称性,所以只统计“\”这种线型的,最后乘2即是答案。 枚举斜线包围盒的大小,如果盒子的长宽ab互质,则是可以的。这种盒子共有(m-a)(n-b)个,但要减去其中重复的。如果有一个长宽为2a和2b的大盒子,则计数右下角的小盒子的同时,左上角的小盒子会重复,
·
2015-11-02 11:44
uva
poj 2485
Highways
最小生成树
poj 2485
Highways
//poj 2485
Highways
//MST(minimum spanning tree) //here is want to get the longest
·
2015-11-02 09:00
最小生成树
poj 2485
Highways
(prim)
http://poj.org/problem?id=2485 题不难,题目很难... 读了好几遍还是给理解错了,纠结! 就是求最小生成树里最大的边权值,拿过来poj1287一改就交,果断WA..仔细一看,权值的更新给搞错了,这是要让我郁闷到极点啊! #include<cstdio> #define Max(a, b) &n
·
2015-11-01 16:28
Prim
POJ 2485
Highways
题目大意:给定各村间的距离,用最少话费修建通路联通所有村,并得到修建路中最长的那一段。 这一题和之前HDU 1102题极其相似,可我在这用了同样的Kruscal算法却达到了800+ms的时间 我的代码: 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring>
·
2015-11-01 14:37
poj
POJ 2485
Highways
Highways
Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on PKU.
·
2015-11-01 11:24
poj
Highways
// source code of submission 542687, Zhongshan University Online Judge System //经典的最小生成树算法(基于并查集)首先,要对所有边按权从小到大排序, //其次,要淘汰一些边,即使它们的权很小,但在生成树中它们是多余的(即构成环), //这里我们可以用并查集来解决。每选取一条边,我们就把这条边的两个顶点放进同一个连
·
2015-10-31 12:37
CI
BZOJ3488 : [ONTAK2010]
Highways
对于询问(x,y),恰经过一条非树边且不经过树上两点间路径的路径数为: ·若x与y成祖先-孩子关系,假设y是x的祖先,z是y到x方向的第一个节点,则 ans=起点在x的子树里,且终点不在z的子树里的非树边数 ·若x与y不成祖先-孩子关系,则 ans=起点在x的子树里,且终点在y的子树里的非树边数 由于不经过任何非树边也有一解,所以答
·
2015-10-31 11:48
ZOJ
[ACM_图论]
Highways
(变形说法的最小生成树)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28972#problem/C 题目给出T种情况,每种情况有n个城镇,接下来每一行是第i个城镇到所有城镇的距离(其实就是个可达矩阵)。 求建设一条公路联通所有城镇并且要求最长的一段最小(其实就是最小生成树)!代码如下: #include<
·
2015-10-31 11:34
最小生成树
poj2485
Highways
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10676
·
2015-10-31 10:09
poj
分量算法poj 1751
Highways
最小生成树之Kruskal(克鲁斯卡尔)算法
上班之余抽点时间出来写写博文,希望对新接触的朋友有帮助。今天在这里和大家一起学习一下分量算法 标题链接:http://poj.org/problem?id=1751 大意是一个有n个都会的国度,已知有些都会有途径联通,问增加哪些途径使得所有的都会都可以彼此联通且价值最小,已价值是两个都会坐标的笛卡尔
·
2015-10-31 09:13
最小生成树
POJ 2485
Highways
意甲冠军:给你一个数n,代表n村庄,然后你进入到n行n列数,文章i第一线j代表元素i村庄和j从村,要确定您的沟通n维修所需的村庄最短的最大边 思路:用Kruskal算法求 AC代码: #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #define
·
2015-10-30 15:41
poj
快速切题 poj 2485
Highways
prim算法+堆 不完全优化 难度:0
Highways
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23033
·
2015-10-30 13:24
Prim
soj1090.
Highways
Highways
Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description The island nation of Flatopia
·
2015-10-30 13:58
wa
poj 1751
Highways
最小生成树 prim
#include #include #include #include #include usingnamespacestd; constintinf=0x3f3f3f3f; constintN=1024; boolvis[N]; intdis[N]; inte[N][N],a[N],b[N],cnt,use[N]; intu1[N],v1[N]; voidprim(intn) { inti,j
xinag578
·
2015-10-30 13:00
POJ 最小生成树专辑
最下生成树题目汇集: POJ 2845
Highways
http://poj.org/problem?
·
2015-10-28 08:11
最小生成树
Highways
Highways
Time Limit: 1000ms Memory Limit: 10000KB 64-bit integer IO format: %lld  
·
2015-10-28 08:02
part
POJ-2485
Highways
最小生成树
一道简单的最小生成数,求使得所有的路连通的最小总路程代价中的最长的子路的长度。 代码如下: #include <cstring> #include <cstdlib> #include <cstdio> #include <algorithm> using namespace std; int N, pos, set[505];
·
2015-10-27 14:15
最小生成树
poj 1751
Highways
(最小生成树)
题目链接: http://poj.org/problem?id=1751 题目大意: 给出n个点,每个点用二维坐标表示,不会用任意两个点在同一位置,在这n个点之间已经有m条道路了,问在花费最少的情况下修建那几条路能把所有的点连在一起? 解题思路: 对任意一个点向其他的点建边,因为建图的时候,边比较密集,所以最好用prim算法求最短路,ps:我刚开始是多实例,一直tle,最后搜
·
2015-10-23 08:47
最小生成树
上一页
1
2
3
4
5
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他