刚学python,学到了有关于类和对象的地方。对一个概念有点模糊,后来通过实践编码找到一定规律
在python中
class test(object):
id=2
name='tt' list=['tt','dd']
def change(self,newA,new_id):
self.id=new_id
self.age=new...
分类:
编程语言 时间:
2014-06-25 19:29:20
阅读次数:
267
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:
其他好文 时间:
2014-06-24 23:30:08
阅读次数:
278
【题目】
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note:
You may not engage in multiple transactions at the same time (i...
分类:
其他好文 时间:
2014-06-24 23:28:43
阅读次数:
223
图像金字塔
目标
本文档尝试解答如下问题:
如何使用OpenCV函数 pyrUp 和 pyrDown 对图像进行向上和向下采样。
原理
Note
以下内容来自于Bradski和Kaehler的大作: Learning OpenCV 。
当我们需要将图像转换到另一个尺寸的时候, 有两种可能:
放大 图像 或者缩小 图像。...
分类:
其他好文 时间:
2014-06-24 22:54:22
阅读次数:
346
Given a collection of integers that might contain duplicates, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not contain duplica...
分类:
其他好文 时间:
2014-06-24 20:58:32
阅读次数:
230
看了2个blog后还是没闹明白 因为Django的东西 所以自己写了test的例子终于明白了
首先给出结论---->别人总结的可惜一开始没闹明白:
1. super并不是一个函数,是一个类名,形如super(B, self)事实上调用了super类的初始化函数,
产生了一个super对象;
2. super类的初始化函数并没有做什么特殊的操作,只是简单记录了类类型和具体实例;...
分类:
编程语言 时间:
2014-06-24 18:39:17
阅读次数:
342
【原题】
1799: [Ahoi2009]self 同类分布
Time Limit: 50 Sec Memory Limit: 64 MB
Submit: 554 Solved: 194
[Submit][Status]
Description
给出a,b,求出[a,b]中各位数字之和能整除原数的数的个数。
Input
Output
Sample ...
分类:
其他好文 时间:
2014-06-24 18:38:02
阅读次数:
295
一:勘误
classifier类中: def fprob(self, f, cat):
if self.catcount(cat) == 0:
return 0
#notice: rember change int to double or float
# + 0.0 or *1.0 is ok, other wise, may get 0.
return self.fc...
分类:
其他好文 时间:
2014-06-24 17:49:42
阅读次数:
211
【题目】
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a palindrome.
Note:
Have you consider that the string m...
分类:
其他好文 时间:
2014-06-24 15:35:07
阅读次数:
150
在.m文件中使用对象方法:- (id)init{_name =@“zhangsan”;_age = 18;return self;}然后通过main方法中进行创建对象并初始化:例如:Person *p1 = [[Person alloc] init];类方法alloc是分配内存空间,对象方法init...
分类:
其他好文 时间:
2014-06-24 15:13:45
阅读次数:
170