C_and_CPP 版 (精华区)
发信人: yuanlaishini (缘来是你), 信区: C_and_CPP
标 题: 强人来看!求PI精确值的怪异程序
发信站: BBS 哈工大紫丁香站 (Mon Nov 8 19:33:04 2004)
#include <stdio.h>
long a=10000, b, c=2800, d, e, f[2801], g;
main(){
for(;b-c;)f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
}
(本程式可算出pi值连小数点前共800位)
运行通过,答案正确
--
※ 来源:·哈工大紫丁香 http://bbs.hit.edu.cn·[FROM: 210.46.78.12]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.971毫秒