s1 = set('abc')s2 = set('abs')# 在s1而不在s2print s1 - s2# set(['c'])# 在s1或者s2print s1 | s2# set(['a', 'c', 'b', 's'])# 在s1同时也在s2print s1 & s2# set(['a', ...
分类:
其他好文 时间:
2015-08-30 17:25:03
阅读次数:
135
绝对值 abs()、最大值 max()、最小值 min()>>> abs(-9)
9
>>> l = (2,1,3,5,77,222,97)
>>> max
>>> max(l)
222
>>> min(l)
1len()、divmod()、pow()、round()>>> a = "hello"
>>> len(a)
5
>>> divmod(5,2...
分类:
编程语言 时间:
2015-08-30 15:56:11
阅读次数:
210
链接:http://acm.hdu.edu.cn/showproblem.php?pid=3450
题意:
给你一串长度为n的序列,给一个d,要求找出有几个子序列能够满足两个相邻的元素之间差值不超过d。
思路:
dp。定义dp[i]表示以第i个为结束的满足条件的子序列的个数。
转移方程:dp[i]=(∑i?1j=1dp[j])+1(abs(num[i]?num[j])<=d)dp[i] =...
分类:
其他好文 时间:
2015-08-29 17:04:16
阅读次数:
188
1、DateTime t1 = Convert.ToDateTime("2006-1-6"); DateTime t2 = Convert.ToDateTime("2006-1-16"); int day=Math.Abs(((TimeSpan)(t1 - t2)).Days); 2、dated.....
Notes on Training recurrent networks online without backtrackingLink:http://arxiv.org/abs/1507.07680SummaryThis paper suggests a method (NoBackTrack) ...
分类:
Web程序 时间:
2015-08-29 11:11:30
阅读次数:
178
Days ago, I purchased a hand-held diagnostic tool, Autel MaxiCheck PRO, for $239 USD from China. This morning, I used it for resetting ABS System on m...
分类:
其他好文 时间:
2015-08-29 09:45:28
阅读次数:
211
纸上得来终觉浅,绝知此事要躬行
--陆游 问渠那得清如许,为有源头活水来 --朱熹
ArrayList简介:ArrayList是一个数组队列,相当于一个动态的数组,容量可以动态的增长;它继承了AbstractList并实现了List,RandomAccess,Cloneable、Serializable这些接口。
特性:
(1)ArrayList继承了Abs...
分类:
编程语言 时间:
2015-08-28 00:51:12
阅读次数:
320
一.函数与形参1.函数function abs(x) { if (x >= 0) { return x; } else { return -x; }}alert(abs(-10));2.匿名函数var abs = function (x) { if...
分类:
编程语言 时间:
2015-08-28 00:27:49
阅读次数:
175
一、简介 ArrayList是一个数组队列,相当于动态数组。每个ArrayList实例都有自己的容量,该容量至少和所存储数据的个数一样大小,在每次添加数据时,它会使用ensureCapacity()保证容量能容纳所有数据。 1.1、ArrayList 的继承与实现接口 ArrayList继承于Abs...
分类:
编程语言 时间:
2015-08-28 00:24:53
阅读次数:
368
python中有内置的函数,我们可以直接调用来使用。调用函数需要写函数名和参数。
一、abs():求绝对值的函数,这个函数需要传一个整数或者浮点数作为参数。
如果参数个数传递错误,函数会报错:需要一
个参数,但是给了两个
如果参数类型传递错误,函数也会报类型错误:
二、cmp():比较大小函数,需要传进两个参数
cmp(x,y)
当x>y,返回1;...
分类:
编程语言 时间:
2015-08-25 21:55:05
阅读次数:
183