- 博客(2)
- 收藏
- 关注
原创 钢条(木条)切割问题
import time # the price of a piece of steel of a certain length, which is the index p=[1,5,8,9,10,17,17,20,24,30] # the length of the first piece of a best split given a certain length of the steel, which is the index bestSplit=[] # the length of the s.
2021-07-09 14:04:20
247
原创 输出全排列
用python语言,以递归的方式输出全排列。代码较简洁。算法复杂度O(n!),最优。最大递归深度为n。 import copy out = [] def permutation(a): global out if len(a) == 1: out.append(a[0]) print(out) out.pop() return for i in range(len(a)): t = copy.cop...
2021-07-08 23:11:39
150
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅