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
Roads
poj 2631
Roads
in the North 【树的直径裸题】
RoadsintheNorthTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 2350 Accepted: 1152DescriptionBuildingandmaintainingroadsamongcommunitiesinthefarNorthisanexpensivebusiness.Withthisinmind,theroad
chenzhenyu123456
·
2015-08-03 12:00
暑假-动态规划 III-(A - Constructing
Roads
In JGShining's Kingdom)
/* 题意:有2n个城市,其中有n个富有的城市,n个贫穷的城市,其中富有的城市只在一种资源富有, 且富有的城市之间富有的资源都不相同,贫穷的城市只有一种资源贫穷,且各不相同, 现在给出一部分贫穷城市的需求,每个需求都是一个贫穷的向一个富有的城市要资源, 且每个富有的城市都想向贫穷的城市输入自己富有的那部分资源,现在为了运输要建设多条路, 但是路与路之间不允许有交叉,求满足贫穷城市的各种要求最多可以
slime_kirito
·
2015-08-02 11:00
动态规划
POJ 2749 && HDU 1815 Building
roads
(2-SAT+二分)
Desciption给出n个牛棚、两个特殊点s1,s2的坐标。s1,s2直连。牛棚只能连s1或s2。还有,某些牛棚只能连在同一个s,某些牛棚不能连在同一个s。求使最远的牛棚间的最小距离(距离是曼哈顿距离)Input第一行包括三个整数n,A,B分别表示牛棚数量,需要连在不同s的牛棚对数需要连在相同s的牛棚对数,第二行四个整数表示s1,s2的坐标,之后A行每行两个整数a和b表示a牛棚与b牛棚需要连在不
V5ZSQ
·
2015-08-01 18:00
uva 10308
Roads
in the North 北方的道路
原题:BuildingandmaintainingroadsamongcommunitiesinthefarNorthisanexpensivebusiness.Withthisinmind,theroadsarebuiltinsuchawaythatthereisonlyoneroutefromavillagetoavillagethatdoesnotpassthroughsomeothervi
·
2015-07-30 20:00
uva
D - Constructing
Roads
- 2421
题意:有一些村庄需要修一些道路是所有村庄都可以连接,不过有些道路已经修好了,问题最少还需要修建的道路长度是多少。 输入的第一行是一个N代表N个村庄,下面是一个N*N的矩阵,代表着q->j的距离,然后输出一个Q,接着有Q行,表示AB已经修建的村庄 分析:为了增加麻烦他们设定了一些已经修建的村庄,不过可以使用krusal做,把已经修建的边都连接上,这些麻烦也仅仅如此。。。
·
2015-07-24 20:00
struct
A - Jungle
Roads
- poj 1251(简单)
想必看这道题的时候直接看数据还有那个图就能明白什么意思吧,说的已经很清楚了,每个点都有一些相连的点和权值,求出来如果连接所有点,最小的权值是多少,赤裸裸的最小生成树。。。 ************************************************************************************ #include<iostream>
·
2015-07-24 19:00
poj
hdu 1301 Jungle
Roads
#include usingnamespacestd; constintinf=1<<24; intmain() { intn,i,j,k,e[50][50],u,v,w,low[50],ans; chars; while(~scanf("%d",&n)) { if(n==0)break; memset(e,0,sizeof(e)); getchar(); for(i=0;i
xinag578
·
2015-07-20 17:00
hdu 1102 Constructing
Roads
#include #include #include #include #include #include #include #include #include #include #include #include usingnamespacestd; structdata { intu,v,w; }e[105*105]; intbin[100+5],use[100+5][100+5],mp[10
xinag578
·
2015-07-20 12:00
HDU 1301 Jungle
Roads
(Prim求最小生成树)
题目地址:点击打开链接思路:最小生成树模板题,刚开始各条路之间的距离设为INT_MAX(int类型的最大数)AC代码:#include #include #include usingnamespacestd; intmap[30][30],visit[30],lowcost[30]; intmain() { chara,b; intn,i,j,num,num1,min,k,sum; while
qq_25605637
·
2015-07-18 22:00
HDU 1102 Constructing
Roads
(Prim求最小生成树)
题目地址:点击打开链接思路:只要把已经建立的路之间的距离设为0,就变成最小生成树的模板题AC代码:#include #include intmain() { intn,q,i,j,a[110][110],visit[110],lowcost[110],min,k,sum; intx,y; while(scanf("%d",&n)!=EOF) { sum=0; memset(a,0,sizeof(a
qq_25605637
·
2015-07-18 21:00
poj1724--
ROADS
(最短路变形)
题目链接:点击打开链接题目大意:给出n个点,m条路径(有向),每条边有一个花费和一个长度,要求在给定的花费内求1到n的最短路径用dis[i][j]表示从1到i点,花费为j的最短路径,跑spfa,求出最短路#include #include #include #include usingnamespacestd; #defineINF0x3f3f3f3f structnn{ intv,l,t; in
u013015642
·
2015-07-17 15:00
poj3411--Paid
Roads
(bfs+状压)
题目链接:点击打开链接题目大意:有n个点,m条有向边,经过边需要一个花费,abcpq代表a到b的一条道路,如果经过这条边之前经过c点,那么需要p的花费,否则需要q的花费,问从1点到n点的最小花费。方法1、每条边可能会经过多次,每个点也可以经过多次,这样就没有了边界不能直接进行dfs,因为要记录之前经过的边,所以使用状压,dis[i][j]:当前在第i个点,j表示经过了的点,这样就可以得到推导的公式
u013015642
·
2015-07-17 15:00
【贪心】 NWERC 2013 Absurdistan
Roads
1
先做最小生成树,然后找距离不相同权值最小的边。。。。#include #include #include #include #include #include #include #include #include #include #include #include #include #definemaxn2005 #definemaxm4000005 #defineeps1e-7 #define
blankcqk
·
2015-06-30 15:00
贪心
使用Google
Roads
API抓取道路信息(java实现)
具体的调用方法如下:https://
roads
.googleapis.com/v1/snapToRoads?
vernice
·
2015-06-26 22:00
java
api
api
Google
Google
Google
地图
地图
Roads
道路坐标
LightOJ1002---Country
Roads
(最短路变形)
Iamgoingtomyhome.Therearemanycitiesandmanybi-directionalroadsbetweenthem.Thecitiesarenumberedfrom0ton-1andeachroadhasacost.Therearemroads.YouaregiventhenumberofmycitytwhereIbelong.Nowfromeachcityyouha
Guard_Mine
·
2015-06-02 20:00
最短路
Roads
not only in Berland CodeForces 25D 并查集
D.RoadsnotonlyinBerlandtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBerlandGovernmentdecidedtoimproverelationswithneighboringcountries.Firstofall,itwasde
wust_ZJX
·
2015-05-18 20:00
CF Destroying
Roads
(最短路)
原文链接:http://www.cnblogs.com/xz816111/p/4508187.htmlDestroyingRoadstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputInsomecountrythereareexactlyncitiesandmbid
weixin_34198762
·
2015-05-16 17:00
Codeforces544D:Destroying
Roads
(最短路)
Insomecountrythereareexactly n citiesand m bidirectionalroadsconnectingthecities.Citiesarenumberedwithintegersfrom 1 to n.Ifcities a and b areconnectedbyaroad,theninanhouryoucangoalongthisroadeitherfr
libin56842
·
2015-05-15 13:00
codeforces
Destroying
Roads
最短路+暴力
最短路+暴力,暴力BFS求任意两点间的短路,然后暴力枚举哪一段是公共的B.DestroyingRoadstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputInsomecountrythereareexactly n citiesand m bidirectional
u012797220
·
2015-05-14 09:00
POJ1947---Rebuilding
Roads
(树形dp,背包)
DescriptionThecowshavereconstructedFarmerJohn’sfarm,withitsNbarns(1FileName:POJ1947.cpp>Author:ALex>Mail:
[email protected]
>CreatedTime:2015年05月12日星期二16时50分33秒****************************************
Guard_Mine
·
2015-05-12 21:00
dp
【最短路】 Codeforces Round #302 (Div. 1) B - Destroying
Roads
先对所有点做bfs求出任意两点间最短距离,然后暴力枚举中转点i,j求出答案。。。。#include #include #include #include #include #include #include #include #include #include #include #include #include #definemaxn3005 #definemaxm10005 #defineep
blankcqk
·
2015-05-09 10:00
最短路
poj1947Rebuilding
Roads
(树形dp)
题目:poj1949RebuildingRoads题意:给出一棵树,问现在要得到一颗有p个节点的子树,需要最少减掉几条边?分析:首先可以明确是一个树形dp题目,状态也很好定义:dp【root】【j】:以root为根节点的子树,得到j个节点的子树需要最少减掉的边数,注意子树中必须保留root节点。否则无法dp那么很明显的边界条件dp【root】【1】=num(儿子的个数),因为要只剩一个节点的子树,
y990041769
·
2015-04-30 20:00
dp
root
分析
num
树形DP
UVA - 10308 -
Roads
in the North (DFS)
题目传送:UVA-10308思路:就是树的遍历,DFS即可,注意输入AC代码:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #defineLLlonglong #defineINF0x7ffff
u014355480
·
2015-04-30 00:00
ACM
gcd
uva
HDU 1102 Constructing
Roads
(最小生成树+Kruskal算法入门)
【题目链接】:clickhere~~【题目大意】:已知某几条道路已经修完,求全部道路要通路的最小花费【解题思路】:基础的Kruskal算法了,按照边的权值从小到大排序一遍,符合条件加入到生成树中代码:/* Author:HRW kruskal+并查集 */ #include usingnamespacestd; constintmax_v=105; constintinf=0x3f3f3f3f;
u013050857
·
2015-04-25 09:00
数据结构
最小生成树
hdu_1301 Jungle
Roads
#include #include #include #include #defineN100005 usingnamespacestd; intfather[N]; structnode { intu,v,w; }save[N]; intcmp(nodea,nodeb) { returna.wy) father[x]=y; else father[y]=x; } intmain() { int
u014142379
·
2015-04-25 09:00
Algorithm
HDU
Spanning
Tre
Minimun
hdu_1102 Constructing
Roads
#include #include #include #include #include usingnamespacestd; #defineN10005 intFather[N]; structnode { intu,v,w; }; nodevertex[N]; boolcmp(nodea,nodeb) { returna.w>n) { k=0,ans=0; for(i=1;i>save[i]
u014142379
·
2015-04-25 09:00
hud
Spanning
Tre
Minimun
Ilya and
Roads
EverythingisgreataboutIlya’scity,excepttheroads.Thethingis,theonlyZooVilleroadisrepresentedasnholesinarow.Wewillconsidertheholesnumberedfrom1ton,fromlefttoright.Ilyaisreallykeeponhelpinghiscity.So,hew
Guard_Mine
·
2015-04-02 20:00
dp
HDU 1301--Jungle
Roads
【Kruskal】
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4808 AcceptedSubmission(s):3530ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanh
hpuhjh
·
2015-03-31 19:00
用GeoServer发布本地Shapefile地图数据
这是GeoServer官方网站提供的一份Shapefile测试数据 nyc_
roads
.zip ,包含了部分纽约的道路信息,我们本次就使用此Shapefile来进行部署和发布。
shibing624
·
2015-03-24 21:00
Web
服务器
geoserver
地图
shapefile
All
Roads
Lead to Rome (30)
#include #include #include #include #include usingnamespacestd; constintN=300; intpos; stringname[300]; ints2i(strings) { staticunordered_mapnth; autoit=nth.find(s); if(it!=nth.end()) returnit->second
u013827143
·
2015-03-18 13:00
UVA - 10308
Roads
in the North
题目大意:给出一个无环无向图,求任意两点间的最大距离。输入空行问该组测试输入结束。解题思路:输入比较恶心,因为这个WA了一次,这题可以用dfs去做,任意选一个节点作为根节点,然后遍历与它相连的所有点,维护最大值就可以了,因为任意两点可以看成是以父亲节点而相连的。#include #include #include #include usingnamespacestd; structNode{ i
kl28978113
·
2015-03-17 20:00
POJ3411 Paid
Roads
DFS
题目大意:有n个城市和m条道路(城市编号为1到n),从a城市经过c城市到达b城市(这里的a和c可以是同一个城市)的过路费有两种:(1)如果c城市已经走过,那么路费为p;(2)c城市没有走到过时路费为r;现在给出m条道路的信息,让你求出从城市1到城市n所需的最少路费。分析:乍一看这倒题像是图论中的最短路问题,可是仔细想想并不是那回事。题中并没有说哪两个城市之间可达,只是说了从a城市经过c城市到达b城
AC_Gibson
·
2015-03-17 12:00
poj1947--Rebuilding
Roads
(树状dp)
RebuildingRoadsTimeLimit: 1000MS MemoryLimit: 30000KTotalSubmissions: 9496 Accepted: 4316DescriptionThecowshavereconstructedFarmerJohn'sfarm,withitsNbarns(1 #include #include usingnamespacestd; #d
u013015642
·
2015-03-06 20:00
Jungle
Roads
题目链接JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4747 AcceptedSubmission(s):3485ProblemDescriptionTheHeadElderofthetropicalislandofLagris
qq_18661257
·
2015-03-06 18:00
All
Roads
Lead to Rome (30)
题目:IndeedtherearemanydifferenttouristroutesfromourcitytoRome.Youaresupposedtofindyourclientstheroutewiththeleastcostwhilegainingthemosthappiness.InputSpecification:Eachinputfilecontainsonetestcase.For
Yangsongtao1991
·
2015-03-02 19:00
考试
pat
浙江大学
【BZOJ 1116】 [POI2008]CLO
: 10Sec MemoryLimit: 162MBSubmit: 612 Solved: 333[Submit][Status]DescriptionByteotia城市有n个townsm条双向
roads
Regina8023
·
2015-03-02 08:00
并查集
OI
bzoj
hdu 1102 Constructing
Roads
最小生成树Prim算法AC 水~~~
ConstructingRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):15230 AcceptedSubmission(s):5826ProblemDescriptionThereareNvillages,whicharenumberedfr
Lionel_D
·
2015-02-23 14:00
最小生成树
Prim
Roads
hdu1102
Constructing
hdu 1301 Jungle
Roads
一个很水的题 AC率也可以知道了 但是题目很难理解啊 英语渣o(╯□╰)oKruskal算法
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4725 AcceptedSubmission(s):3471ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanh
Lionel_D
·
2015-02-23 13:00
最小生成树
kruskal
hdu1301
Jungle
Roads
NYOJ 434 && POJ 1251 Jungle
Roads
(最小生成树)
链接:clickhere题意:题目大意在相通n个岛屿的所有桥都坏了,要重修,重修每一个桥所用的时间不同,求重修使每个岛屿都间接或直接与其他岛屿相同时所用的的最短时间(只有修完一个桥后才可修下一个桥)。简言之就是求最小生成树。对于数据,数据输入的第一行n代表岛屿的个数,当为0是结束程序,接着n-1行开始时为这岛屿的编号,用大写字母表示,接着是一个整数m,表示与该岛屿连接的字典序大于该岛屿编号的个数,
u013050857
·
2015-02-21 20:00
最小生成树
hdoj 1301 Jungle
Roads
【最小生成树】
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4704 AcceptedSubmission(s):3455ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanh
chenzhenyu123456
·
2015-02-12 22:00
Gym 100339A Bike
Roads
AndrewStankevichContest23Petrozavodsk,February1,2007ProblemA.BikeRoadsAndrewlivesatcountryside.Theareahelivesathastwobikeroads,eachofwhichhastheformofacirclewithradiusr.Roadshavenocommonpoints.Andrew’
u013007900
·
2015-02-11 22:00
codeforces 313D Ilya and
Roads
(区间dp)
题意:n个洞,m个公司,至少补k个洞,每个公司只能补Li到Ri之间的懂,并且费用是ci。问补至少k个洞的最小费用。题解:首先我么要这题要知道任意段区间之间的费用是多少,因为公司的区间是可以重合的,但是重合部分要多计算,那么我们可以用(n^3)的计算出任意段区间的费用。接着我们就可以dp了,dp[i][j]表示前i个点补了k个洞的最小费用。状态方程和往常非常不同本来是要O(n^4)现在优化了一个地方
My_ACM_Dream
·
2015-02-09 17:00
hdoj 1102 Constructing
Roads
【最小生成树】
ConstructingRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):15020 AcceptedSubmission(s):5732ProblemDescriptionThereareNvillages,whicharenumberedfrom
chenzhenyu123456
·
2015-01-28 19:00
hdu 1102 & poj 2421 Constructing
Roads
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1102ConstructingRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):14983 AcceptedSubmission(s):5715Pro
u014427196
·
2015-01-25 17:00
poj-1251 Jungle
Roads
题目链接:http://poj.org/problem?id=1251简单题#include #include #include #include #include #include #include usingnamespacestd; #defineINF10000000 intn,m; chara[5],b[5]; intc,d; intmap[100][100],dis[100],v
u014427196
·
2015-01-25 14:00
算法
ACM
Constructing
Roads
In JGShining's Kingdom(最长上升子序列)
ConstructingRoadsInJGShining'sKingdomTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):16956 AcceptedSubmission(s):4819ProblemDescriptionJGShining'skingd
ZSGG_ACM
·
2015-01-23 00:00
dp
SZUOJ-Problem(A60):
Roads
JudgeInfoMemoryLimit:32768KBCaseTimeLimit:10000MSTimeLimit:10000MSJudger:NumberOnlyJudgerDescriptionActually,Mr.Kisafamousengineer.Hegotabigprojectresently.Heisaskedtobuildroadstoconnectseveralcity.At
viphong
·
2015-01-22 00:00
HDU1301 POJ1251 Jungle
Roads
【Prim】【最小生成树】
JungleRoadsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):4591 AcceptedSubmission(s):3371ProblemDescriptionTheHeadElderofthetropicalislandofLagrishanhasap
u011676797
·
2015-01-19 22:00
poj_2421_mst
D - Constructing
Roads
Time Limit:2000MS Memory Limit:65536KB 
·
2015-01-19 13:00
poj
Pat(Advanced Level)Practice--1087(All
Roads
Lead to Rome)
Pat1087代码题目描述:IndeedtherearemanydifferenttouristroutesfromourcitytoRome.Youaresupposedtofindyourclientstheroutewiththeleastcostwhilegainingthemosthappiness.InputSpecification:Eachinputfilecontainsonet
u012736084
·
2015-01-09 23:00
DFS
dijkstra
pat
advance
上一页
14
15
16
17
18
19
20
21
下一页
按字母分类:
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
其他