level 8
from datetime import *
def ms(a):
b=0.0
b=b+(a.day*24+a.hour)*3600
b=b+a.minute*60
b=b+a.second+a.microsecond/1000000
return b
a=datetime.now()
b1=ms(a)
ori=0
pre=1e-12
N=200000000
for i in range(1,N):
ori=ori+pre
a=datetime.now()
b2=ms(a)
c=(b2-b1)
print("N=",N)
print("Time used:",c,"seconds")
print("Speed:",N/c,"per second")
2016年09月06日 13点09分


