生成器和普通函数有些区别,比如生成器不用return返回,而用yield来返回一系列元素
除非“召唤”生成器的next(),否则函数体里面不会执行任何代码块,上下文环境保存着。
虽然不需要明确定义__iter__()和next()方法,但是它本身包含这个方法。
当想要结束一个协程时,使用close()方法即可,close会在协程中引发GeneratorExit异常,这时候可以通过try/ex...
分类:
编程语言 时间:
2014-05-10 09:53:34
阅读次数:
317
二分距离2sat
Bomb Game
Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3382 Accepted Submission(s): 1161
Problem Description
R...
分类:
其他好文 时间:
2014-05-10 09:18:11
阅读次数:
318
Alice and Bob
Time Limit: 1000MS Memory limit: 65536K
题目描述
Alice and Bob like playing games very much.Today, they introduce a new game.
There is a polynomial like this: (a0*x^(2^0)...
分类:
其他好文 时间:
2014-05-10 08:44:35
阅读次数:
363
console.time 简单分析javascript动态添加Dom节点的性能...
分类:
编程语言 时间:
2014-05-07 08:54:37
阅读次数:
630
??
Lost Cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 8838
Accepted: 5657
Description
N (2 <= N <= 8,000) cows have unique brands in the range 1..N. ...
分类:
其他好文 时间:
2014-05-07 07:58:26
阅读次数:
337
Paint the Grid Reloaded
Time Limit: 2 Seconds
Memory Limit: 65536 KB
Leo has a grid with N rows and M columns. All cells are painted with either black or white initially.
Two cells A ...
分类:
其他好文 时间:
2014-05-07 07:28:35
阅读次数:
480
Paint the Grid Again
Time Limit: 2 Seconds
Memory Limit: 65536 KB
Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white).
Leo has a...
分类:
其他好文 时间:
2014-05-07 06:56:10
阅读次数:
470
【原题】
1096: [ZJOI2007]仓库建设
Time Limit: 10 Sec Memory Limit: 162 MB
Submit: 1998 Solved: 816
[Submit][Status]
Description
L公司有N个工厂,由高到底分布在一座山上。如图所示,工厂1在山顶,工厂N在山脚。 由于这座山处于高原内陆地区(干燥少雨),L公司一般...
分类:
其他好文 时间:
2014-05-07 06:54:45
阅读次数:
374
Video Surveillance
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 3145
Accepted: 1391
Description
A friend of yours has taken the job of security officer at...
分类:
其他好文 时间:
2014-05-07 06:49:43
阅读次数:
387
(转载请注明出处:http://blog.csdn.net/buptgshengod)
1.背景
上一节学习支持向量机,感觉公式都太难理解了,弄得我有点头大。不过这一章的Adaboost线比较起来就容易得多。Adaboost是用元算法的思想进行分类的。什么事元算法的思想呢?就是根据数据集的不同的特征在决定结果时所占的比重来划分数据集。就是要对每个特征值都构建决策树,并且赋予他们不同的...
分类:
编程语言 时间:
2014-05-07 06:48:25
阅读次数:
569