#include <iostream> #include <cmath> using namespace std; int main() {int i=0,b,n,pi=2; cin>>n; for(b=0;b<=n;b++) { i=sqrt(i+2); pi=pi*(2/i); } cout<<pi<<endl; }
#include <iostream> #include <cmath> using namespace std; int main( void ) { size_t n; cin >> n; double pi = 2; double tmp = 0; for( size_t i=0; i!=n+1; ++i ) { tmp = sqrt(tmp+2.0); pi *= 2.0/tmp; } cout << pi << endl; }