Python的字典和JSON在表现形式上非常相似#这是Python中的一个字典 dic = { 'str': 'this is a string', 'list': [1, 2, 'a', 'b'], 'sub_dic': { 'sub_str': 'this is sub str', 'sub_l...
分类:
编程语言 时间:
2014-07-16 18:09:52
阅读次数:
301
问题描述:给定序列A,输出序列A‘,要求A’中各元素的位置随机化1.构造一个随机数组,使用该数组元素作为key排序数组A1 SHUFFLE(A)2 n = length of A3 create array R[n]4 for i = 0, n-15 R[i]...
分类:
其他好文 时间:
2014-07-16 18:07:36
阅读次数:
190
import sys class Stats: def __init__(self, sequence): # sequence of numbers we will process # convert all items to floats for numeri...
分类:
编程语言 时间:
2014-07-16 18:06:48
阅读次数:
257
一 不需要登录的import urllib2content = urllib2.urlopen('http://XXXX').read() 二 使用代理import urllib2proxy_support = urllib2.ProxyHandler({'http':'http://XX.XX.....
分类:
编程语言 时间:
2014-07-16 17:58:39
阅读次数:
226
题目询问第K大的数//这是我最初的想法,用multiset,AC了——好吧,也许是数据弱也有可能//multiset运用——不去重,边插入边排序//iterator的运用,插入的时候,如果是相同的数没直接放在相同的现有的数据后面的#include#include#include#includeusi...
分类:
其他好文 时间:
2014-07-16 17:52:06
阅读次数:
262
1.定义一个和要排序数组a[10]长度一样的数组, 这里定义为10,index[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},值为10个下标。2. 用冒泡排序,索引值代替小下标即可#include "stdafx.h"int _tmain(int argc, _TCHAR...
分类:
其他好文 时间:
2014-07-16 17:46:21
阅读次数:
244
刚才写了k个,顺手写个2个的,在链表的归并排序中很有用,效率非常好 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next;...
分类:
其他好文 时间:
2014-07-16 17:42:41
阅读次数:
275
思路是这样的,我们从第一个字符开始向后依次找,直到找到一个断句的地方,使得当前获得的子串在dict中,若找到最后都没找到,那么就是False了。
在找到第一个后,接下来找下一个断句处,当然是从第一个断句处的下一个字符开始找连续的子串,但是这时与第一个就稍有不同,比如说word=‘ab’, dict={ 'a', ab', ...},在找到a后,接下来处理的是b,我们发现b不在dict中,但是我们...
分类:
编程语言 时间:
2014-07-16 17:09:39
阅读次数:
273
详见https://github.com/captainwong/instant_markup...
分类:
编程语言 时间:
2014-07-16 09:34:59
阅读次数:
297
无书面授权,请勿转载
第五章 自定义模块
Using a module
Now that we have written our very first module for Ansible, we should give it a
go in a playbook. Ansible looks at several places for its modules: first it looks ...
分类:
其他好文 时间:
2014-07-16 09:14:31
阅读次数:
376