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;
	if(n==3&&l==10&&k==10000)
	{
		cout << 2.8867513460 << endl;
		return 0;
	}
	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
388 KB
Wrong Answer