#include <iostream>
double compute_pi( const int PRECISION )
{
double pi = 4.0;
for( int i = 0; i < PRECISION; ++i )
{
pi += (i % 2 == 0 ? -4.0 : 4.0) / ( 3.0 + i * 2 );
}
return( pi );
}
int main() {
std::cout << compute_pi( 1e6 ) << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKCmRvdWJsZSBjb21wdXRlX3BpKCBjb25zdCBpbnQgUFJFQ0lTSU9OICkKewoJZG91YmxlIHBpID0gNC4wOwoJZm9yKCBpbnQgaSA9IDA7IGkgPCBQUkVDSVNJT047ICsraSApCgl7CgkJCXBpICs9IChpICUgMiA9PSAwID8gLTQuMCA6IDQuMCkgLyAoIDMuMCArIGkgKiAyICk7Cgl9CglyZXR1cm4oIHBpICk7Cn0KCmludCBtYWluKCkgewoJc3RkOjpjb3V0IDw8IGNvbXB1dGVfcGkoIDFlNiApIDw8IHN0ZDo6ZW5kbDsKCXJldHVybiAwOwp9