摘要: ``` #!/usr/bin/env python #coding:utf-8 import sys import math def prime_split(number): i = 2 sqrt_ = math.sqrt(number) while i <= sqrt_: mod_ = number % i if mod_ == 0: ... 阅读全文
posted @ 2015-09-15 21:32 coder_zhang1 阅读(149) 评论(0) 推荐(0) 编辑
摘要: ``` #!/usr/bin/env python #coding:utf-8 SET_START = 1 SET_END = 9 SUB_LEN = 10 def r_subset(i, r, pre, array, sub): if i == r: print sub return j = pre len_ = len(ar... 阅读全文
posted @ 2015-09-15 17:10 coder_zhang1 阅读(283) 评论(0) 推荐(0) 编辑
摘要: ```python #!/usr/bin/env python #coding:utf-8 import sys def gray_code(n): if n < 1: return [] n += 1 array = ["0", "1"] for i in xrange(2, n): times = 2 ** (i-1) ... 阅读全文
posted @ 2015-09-15 15:23 coder_zhang1 阅读(144) 评论(0) 推荐(0) 编辑
摘要: ``` #!/usr/bin/env python #coding:utf-8 import sys def gray_code(num, array): if num < 1: return if num == 1: array.append('0') array.append('1') return g... 阅读全文
posted @ 2015-09-15 10:29 coder_zhang1 阅读(277) 评论(0) 推荐(0) 编辑