摘要:
import random from timewrap import cal_time # 一个计算时间的装饰器 def merge(li, low, mid, high): i = low j = mid + 1 li_tmp = [] while i <= mid and j <= high: if li[i] <= li[j]: ... 阅读全文
摘要:
python自带模块 阅读全文
摘要:
def hanoi(n, A, B, C): if n > 0: hanoi(n-1, A, C, B) print("%s->%s" % (A, C)) hanoi(n-1, B, A, C) hanoi(4, 'A', 'B', 'C') 阅读全文
摘要:
import time def cal_time(func): def wrapper(*args, **kwargs): t1 = time.time() result = func(*args, **kwargs) t2 = time.time() print("%s running time: %s secs." ... 阅读全文