zoukankan      html  css  js  c++  java
  • 带有进度条的圆周率计算

                                                        圆周率的计算

    计算公式:pi / 4=1 - 1/3 + 1/5 - 1/7 + 1/9 ......

    梅钦公式:pi /4 = 4arctan1/5 - arctan1/239

    n=圆周长/直径

    n=圆面积/半径平方

    import math
    import time
    scale=10
    print("执行开始")
    t=time.process_time()
    for i in range(scale+1):
        a,b='**'*i,'..'*(scale-i)
        c=(i/scale)*100
        π=4*(4*math.atan(1/5)-math.atan(1/239))
        print("%{:3}[{}->{}]".format(a,b,c))
        time.sleep(0.1)
    print(π)
    print("{:.2f}s".format(t))
    print("执行结束")
    

      

  • 相关阅读:
    HDU 6043
    HDU 6033
    HDU 6041
    HDU 6050
    HDU 6053
    HDU 6055
    HDU 6045
    HDU 6044
    HDU 6040
    ZUFE 1035 字符宽度编码(字符串)
  • 原文地址:https://www.cnblogs.com/cnn-ljc/p/12539159.html
Copyright © 2011-2022 走看看