Sequence MedianTime Limit:1000MSMemory Limit:65536KTotal Submissions:15792Accepted:4409DescriptionGiven a sequence of N nonnegative integers. Let's de...
分类:
其他好文 时间:
2015-02-16 12:59:30
阅读次数:
136
The Basics基本
在我们看真正的算法之前,先一起看看一个简单的(不准确)的转换正浮点数的方法。如果浮点数可以储存无线精度,那么这个算法的确没有任何问题。但可惜的是,我们的计算机不能精确表示浮点数,这只是一碟在我们在Dragon4前的小菜。
Before diving into the actual algorithm, let's take a look at a simple...
分类:
其他好文 时间:
2015-02-16 11:42:15
阅读次数:
231
赋值运算符如果赋值的右边是一个多元组,它的元素可以马上分解多个变量或变量let (x, y) = (1, 2)// x = 1, y = 2Swift 赋值操作并不返回任何值,所以下面代码是错误的:if x = y { //此句错误,因为x = y 并不反悔任何值}“+” 也可用于字符串的拼接:"h...
分类:
编程语言 时间:
2015-02-15 20:33:05
阅读次数:
284
数值类型转换浮点型:如果没有显式指定类型为 float,swift 会推断为 Double整数转换let twoThousand: UInt16 = 2_000let one: UInt8 = 1let twoThousandAndOne: UInt16 = twoThousand + UInt16...
分类:
编程语言 时间:
2015-02-15 20:31:08
阅读次数:
122
13.3.2 提取地区信息的代码我们下载函数的结果是字符串,因此,需要将字符串解析为 XML 文档。由于这个操作我们将经常要用,所以,要写一个简单的打包函数,用 worldBankDownload 下载数据,以 XDocument 对象的形式返回结果。下载异步运行,因此,我们使用异步工作流实现这个函数:let worldBankRequest(props) = async {
let! text...
分类:
其他好文 时间:
2015-02-15 16:38:29
阅读次数:
204
定义:Convert a interface of class into anthoer interface clients expect. Adapter let classes work together that could't otherwise because of incompat...
分类:
其他好文 时间:
2015-02-15 16:23:36
阅读次数:
146
NYOJ 280 LK的项链 :click here
POJ 2409 Let it Bead:click here
题意:一盒有红、蓝、绿三种颜色的珠子,每种颜色珠子的个数都大于24,现在LK想用这一盒珠子穿出一条项链,项链上的珠子个数为n(0
poj 上是c种颜色,s个珠子组成,数据比24小。
思路:今天刚接触到polya 定理:
Polya定理:设...
分类:
其他好文 时间:
2015-02-15 10:45:22
阅读次数:
172
排序问题 三
前面我们已经稍微的提到了快排,在这里会较详细的说一下快排,嘿嘿,或许不是很专业,话不多说。Let's go!
还是问一下,什么叫做快排?
快速排序的基本思想是,通过一轮的排序将序列分割成独立的两部分,其中一部分序列的关键字(这里主要用值来表示)均比另一部分关键字小。继续对长度较短的序列进行同样的分割,最后到达整体有序。在排序过...
分类:
编程语言 时间:
2015-02-13 16:46:26
阅读次数:
142
This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of d...
分类:
其他好文 时间:
2015-02-12 21:25:40
阅读次数:
365
定义:Defined an interface for creating an object,but let subclasses decide which class to instantiate.Factory Method let a class defer instantiation to ...
分类:
其他好文 时间:
2015-02-12 15:44:15
阅读次数:
237