Created
January 12, 2013 13:43
-
-
Save moolex/4518133 to your computer and use it in GitHub Desktop.
一段神奇的代码,仅仅4行就可以算出Pi的800位
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int 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 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment