http://acm.hdu.edu.cn/showproblem.php?pid=2645找出每个点到距离最近的车站的距离。直接bfs就好。 1 #include 2 #include 3 #include 4 using namespace std; 5 int n,m; 6 int ma...
分类:
其他好文 时间:
2015-06-02 21:45:43
阅读次数:
159
Gas Station Total Accepted: 39396 Total Submissions: 153479There are N gas stations along a circular route, where the amount of gas at station i is ga...
分类:
编程语言 时间:
2015-06-02 12:51:39
阅读次数:
139
我们通过一个例子来体会scala对象的构造过程
首先创建一个车站类:
class Station {
val size = 100
val spots = new Array[String](size)
}
通过size来模拟停车位数,通过字符串数组模拟具体的停车位。
在创建一个停车场类,它是车站的子类
class Park extends Station {
...
分类:
其他好文 时间:
2015-05-26 16:10:44
阅读次数:
174
Channel AllocationTime Limit:1000MSMemory Limit:10000KTotal Submissions:12983Accepted:6649DescriptionWhen a radio station is broadcasting over a very ...
分类:
其他好文 时间:
2015-05-25 17:56:24
阅读次数:
129
用Python计算北京地铁的两站间最短换乘路线地铁数据地铁数据用字典表示:
{station:{neighbor1:line number,neighbor2:line number,…},station2:{…},…}
现在我们有地铁的站名,下面就是如何将地铁站名转化为上面所需要的标准字典格式。
从网上找到的地铁站名为字符串:line1=u'''苹果园 古城路 八角游乐园 八宝山 玉泉路 五...
分类:
编程语言 时间:
2015-05-25 10:12:15
阅读次数:
192
DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this ...
分类:
其他好文 时间:
2015-05-19 16:17:59
阅读次数:
160
这是一个动态规划的题目,假设能跑完全程,最后邮箱中的油肯定还有剩余,由于是一个环形的路线,所以理论来讲,可以从任何地方开始。所以,可以用两个变量来表示这道题目,sum表示全程的油的剩余,而index来表示从何处开始。
1.从任何地方可以开始本次的行程,而sum+=gas[i]-cost[i],若sum=0,说明路线存在且以index为起点的路线为一个可行的路线。...
分类:
其他好文 时间:
2015-05-16 09:05:43
阅读次数:
102
今天开发的时候出现过一个非常奇怪的问题,在保存最终的Bitmap图片的时候,明明使用Directory.Exist(filePath)函数判断当前路径的时候,这些路径都是有用的并且都是合法的,但是就是在执行img.Save(filePath+@"\"+ station [index]+@"\"...
分类:
其他好文 时间:
2015-05-07 20:10:45
阅读次数:
136
DescriptionMany of SKB Kontur programmers like to get to work by Metro because the main office is situated quite close the station Uralmash. So, since...
分类:
其他好文 时间:
2015-05-06 22:40:01
阅读次数:
146
最小生成树,用了Kruskal算法。POJ上C++能过,G++不能过。。。 算出每两个圆心之间的距离,如果距离小于两半径之和,那么这两个圆心之间的距离直接等于0,否则等于距离-R[i]-R[j]。#include#include#include#includeusing namespace std;...
分类:
其他好文 时间:
2015-05-06 17:18:04
阅读次数:
99