Posted in Python onAugust 13, 2013
from sys import argv script, start, end = argv vis = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ans = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def dfs(cur, m): ans[cur] = m if cur == int(end) - int(start) + 1: for i in xrange(int(start), int(end) + 1): print ans[i], print return cur = cur + 1 for i in xrange(int(start), int(end) + 1): if vis[i] == False: vis[i] = True dfs(cur, i) vis[i] = Falsefor i in xrange(1, len(vis)): vis[i] = False dfs(0, start)
python不带重复的全排列代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@