清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
# -*- coding: utf-8 -*-
import time
from pylab import *
Timeuse=[]
def test(n):
#生成位数递增的数#
res=[]
for i in range(1,n+1):
val=''
for j in range(1,i+1):
val+=str(j)
res.append(val)
return res
numSer=(test(10))
print (numSer)
##n=int(input("A number"))
for i in range(len(numSer)):
## weishu=i
## print (i)
n=int(numSer[i])
timeIn=time.clock() #记录程序开始时的系统内核时间,在windows下用time.clock(),在unix下用time.time#
## print (n)
while n>1:
if n%2==0: #判断n的奇偶性,如为偶数除以2,如为奇数则乘3加1#
n=n/2
else:
n=n*3+1
Timeuse.append(time.clock()-timeIn) #用程序结束时的系统内核时间减去开始时的系统内核时间即为程序运行使用的时间#
print(Timeuse)
X = [1,2,3,4,5,6,7,8,9,10] #生成X轴为数字位数,Y轴为时间的效率曲线#
C=Timeuse
plot(X,C)
show()