“那么,你要何法?”
沉思着,他眉头紧皱。
终于,做出了选择。
“我求......倒背圆周率之法!”
“不愧是我看中的人,果然发现了我的提示,既然如此,我便授你此法吧!”
“谢仙长!”
“不急,要能倒背圆周率,我们需要先能算出圆周率,我先教你怎么算吧。”
“点开IDLE,输入:
from sys import stdout
scale = 10000
maxarr = 2800
arrinit = 2000
carry = 0
arr =[arrinit]*(maxarr + 1)
fe(maxarr, 1,-14):
total = 0
fe(i, 0,-1):
total =(total * j)+(scale * arr[j])
arr[j]= total %((j * 2)- 1)
total = total /((j * 2)- 1)
stdout.write(“%04d“%(carry +(total / scale)))
carry = total % scale”
“然后,我们就可以求啦!”