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=1e18;
	//cout << st << " " << en << endl;
	//cout << fixed << setprecision(16);
	for(int i=0;i<10000;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+1e-11)*10000>k)
		{
			st=mid;
		}
		else en=mid;
	}
	cout << fixed << setprecision(10) << (st+en)/2 << endl;
}
Copy
I Shot the Sheriff mahmoudbadawy
GNU G++17
3 ms
368 KB
Wrong Answer