码迷,mamicode.com
首页 >  
搜索关键字:station    ( 711个结果
HDU 4435 charge-station (并查集)
先说下题目的意思: 在一个二维坐标系中有N个点,某人要来个走遍所有点的旅行,但是他的车每次加油后只能走M个单位距离;所以要在这个N点中选一些建立加油站;问题来了:i^th 点 建加油站的花费是 2^(i-1); 求最小话费 用二进制表示;(其中1号必须建立加油站) 思路:有 1000...
分类:其他好文   时间:2014-10-02 14:11:03    阅读次数:159
HDU 2448 Mining Station on the Sea(费用流)
题目地址:HDU 2448 求n次最短路,将n艘船到各港口的最短路求出来,然后用最短路当费用,跑一次费用流。 代码如下: #include #include #include #include #include #include #include #include #include #include #include using namespace std; cons...
分类:其他好文   时间:2014-09-30 12:11:59    阅读次数:223
leetcode - Gas Station
//假设sum为总的耗油量,max为起始点a到终点b的耗油量,如果,当到达b的时候, //max < 0,那么,出发点肯定不能从a开始,这个时候将max = 0,然后,pos = i+1,选择pos为起始点,然后继续遍历。 //如果,最后的sum = 0,则返回pos. class Solution { public: int canCompleteCircuit(std::vector ...
分类:其他好文   时间:2014-09-27 15:36:29    阅读次数:198
快速切题 poj1129 Channel Allocation
Channel AllocationTime Limit:1000MSMemory Limit:10000KTotal Submissions:12334Accepted:6307DescriptionWhen a radio station is broadcasting over a very ...
分类:其他好文   时间:2014-09-25 19:44:27    阅读次数:201
leetcode-Maximum Product Subarray zz
LinkedIn 高频题 – Maximum Sum/ProductSubarrayMaximum Sum Subarray是leetcode原题,跟Gas Station的想法几乎一模一样。解答中用到的结论需要用数学简单地证明一下。123456789101112public int maxSubA...
分类:其他好文   时间:2014-09-25 13:16:18    阅读次数:223
POJ1363【栈】
DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately,...
分类:其他好文   时间:2014-09-23 22:55:45    阅读次数:240
ZOJ 1718 POJ 2031 Building a Space Station 修建空间站 最小生成树 Kruskal算法
首先求出所有的单间两两是否接触如果接触,说明他们之间的边长为0,不接触那么就是圆心的距离减去两个单间的半径。然后构图求最小生成树,采用Kruskal算法。...
分类:其他好文   时间:2014-09-19 23:57:56    阅读次数:480
[leetcode]Gas Station @ Python
原题地址:https://oj.leetcode.com/problems/gas-station/题意:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You ha...
分类:编程语言   时间:2014-09-14 11:19:36    阅读次数:221
Linux下常用软件
一,vmtool安装,进入桌面就后,如果没有看到VMware Tools光盘,请点击VMware Station菜单栏上的“虚拟机”,然后选择“安装VMware Tools”,就可以在桌面上以看到VMware Tools光盘了,安装步骤为:1)把VMware Tools目录复制到备份目录下,2)解压...
分类:系统相关   时间:2014-09-12 16:52:03    阅读次数:237
Gas Station
题意很清晰,每个加油站有一定的油,到下一个站需要消耗一定的油量,这个关系是固定的,这样我们就可以用一个数组来表示汽车到每个加油站以及接下来一段路程增加的油量,即gas[i]-cost[i]; 例如:gas 5 0 9 4 3cost 6 7 5 9 5 seq -1 -7 4 -5 -2这就变成了....
分类:其他好文   时间:2014-09-11 23:37:12    阅读次数:224
711条   上一页 1 ... 62 63 64 65 66 ... 72 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!