Source Code
#include <bits/stdc++.h>

using namespace std;

long double calc(int n,long double l,long double r)
{
	long double a=l/(2*tanl(acosl(-1)/n));
	long double th=2*acosl(a/r);
	long double ar=0.5*(th-sinl(th));
	return acosl(-1)-n*ar;

}

int main()
{
	int n;
	double l,k;
	cin >> n >> l >> k;
	long double st=l/(2*tanl(acosl(-1)/n)),en=1e9;
	//cout << st << " " << en << endl;
	//cout << fixed << setprecision(16);
	for(int i=0;i<200;i++)
	{
		long double mid=(st+en)/2;
		//cout << calc(n,l,mid) << " " << (acosl(-1)) << endl;
		long double ar=calc(n,l,mid)/(acosl(-1));
		//cout << mid << " " << ar << endl;
		if(ar>=k/10000)
		{
			st=mid;
		}
		else en=mid;
	}
	cout << fixed << setprecision(16) << (st+en)/2 << endl;
}
Copy
I Shot the Sheriff mahmoudbadawy
GNU G++17
1 ms
584 KB
Wrong Answer