- 授权协议: GPLv3
- 开发语言: Swift
- 操作系统: OS X
- 软件首页: https://github.com/ochococo/Design-Patterns-In-Swift
- 官方下载: https://github.com/ochococo/Design-Patterns-In-Swift
软件介绍
Design Patterns 是如何使用常用设计模式及示例。
示例:
class MoneyPile { let value: Int
var quantity: Int
var nextPile: MoneyPile? init(value: Int, quantity: Int, nextPile: MoneyPile?) { self.value = value self.quantity = quantity self.nextPile = nextPile
} func canWithdraw(var v: Int) -> Bool { func canTakeSomeBill(want: Int) -> Bool { return (want / self.value) > 0
} var q = self.quantity while canTakeSomeBill(v) { if (q == 0) { break
}
v -= self.value
q -= 1
} if v == 0 { return true
} else if let next = self.nextPile { return next.canWithdraw(v)
} return false
}
}class ATM {
private var hundred: MoneyPile
private var fifty: MoneyPile
private var twenty: MoneyPile
private var ten: MoneyPile
private var startPile: MoneyPile { return self.hundred
} init(hundred: MoneyPile,
fifty: MoneyPile,
twenty: MoneyPile,
ten: MoneyPile) { self.hundred = hundred self.fifty = fifty self.twenty = twenty self.ten = ten
} func canWithdraw(value: Int) -> String { return "Can withdraw: \(self.startPile.canWithdraw(value))"
}
}ACM国际大学生程序设计竞赛题解
赵端阳//袁鹤 / 电子工业 / 2010-7 / 39.00元
随着各大专院校参加ACM/ICPC热情的高涨,迫切需要有关介绍ACM国际大学生程序设计竞赛题解的书籍。《ACM国际大学生程序设计竞赛题解(2)》根据浙江大学在线题库的部分题目,经过分类、筛选、汇编,并进行了解答(个别特别简单或者特别复杂的题目未选择),比较详细地分析和深入浅出地讲解了解题的方法和用到的算法。题目的类型包括基础编程、模拟、字符串处理、搜索、动态规划、回溯、图论、几何和数学题。 ......一起来看看 《ACM国际大学生程序设计竞赛题解》 这本书的介绍吧!
