博客> π
π
2018-11-12 03:38 评论:0 阅读:293 97215321
设计模式

define M 2800

long yushu[M+1], k = 0, i = 0, j = 0, sum = 0, PI = 0; for (k = 0; k <= M; k++) yushu[k] = 1000 2; for (i = 1; i <= 100000 ; i++) { for (j = M, sum = 0; j > 0; j--) { sum += yushu[j] 10000; yushu[j] = sum % (2 j + 1); sum /= (2 j + 1); sum = j; } sum += yushu[j] 10000; yushu[j] = sum % (2 * j + 1); printf("%.4ld", PI + sum / 10000); PI = sum % 10000; }

收藏
1
sina weixin mail 回到顶部