Source Code
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second

using namespace std;

const ll Mod=1e9+7;

ll poww(ll a,ll b,ll mod){
    ll res=1;if(b<0)b=(b%(mod-1)+mod-1)%(mod-1);
    for(;b;b>>=1,a=1ll*a*a%mod)
      if(b&1)res=1ll*res*a%mod;
    return res;
}

void Max(ll& x,ll y){
x=max(x,y);
}
void Min(ll& x,ll y){
x=min(x,y);
}

void OK(bool yes){
    cout<<(yes?"YES\n":"NO\n");
}

const ll N=500500,M=2010,LN=(1<<24),K=17,Mx=3e5,inf=3e18;
const ld pi=acos(-1),eps=1e-12;

ll a[N];
ld root(ld x){
ld mn=1e-10,mx=10000000.0;
while(mn<mx){
    ld mid=(mn+mx)/2.0;
    if(fabs(mid*mid-x)<eps){
        return mid;
    }
    if(mid*mid>x){
        mx=mid;
    }
    else{
        mn=mid;
    }
}
}
ld roott(ld x){
ld mn=1e-10,mx=10000000.0;
while(mn<mx){
    ld mid=(mn+mx)/2.0;
    if(mid*mid-x<eps&&mid*mid>x){
        return mid;
    }
    if(mid*mid>x){
        mx=mid;
    }
    else{
        mn=mid;
    }
}
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    //freopen("triangles.in","r",stdin);

    int T=1;
    //cin>>T;
    while(T--){
        int n,a;
        ld k;
        cin>>n>>a>>k;
        k/=10000.0;
        ld teta=pi/(1.0*n);
        ld pA=a/(2.0*tan(teta))*a/2.0*n;
        //ld l=a/(2.0*tan(teta)),r=a/root(2-2*cos(2.0*teta))+0.1;
        ld l=0,r=teta;
        ld mn=l;
        cout<<fixed<<setprecision(12);
        //cout<<pA<<'\n';

        //cout<<l<<' '<<r<<' '<<cos(teta)<<'\n';
        for(int i=0;i<400;i++){
            ld mid=(l+r)/2.0;
            ld mk=mid*mid-l*l;
            ld ch=1.0-(1.0*n)/pi*(mid-sin(mid)*cos(mid));
            //cout<<ch<<' '<<mid<<' '<<l<<' '<<r<<'\n';
            if(ch>k){
                l=mid;
            }
            else{
                r=mid;
            }
            //cout<<l<<' '<<ch<<' '<<mid<<' '<<r<<'\n';
        }
        if(fabs(teta-l)<eps)cout<<sqrt(pA/k/pi)-10*eps<<'\n';
        else cout<<a/(2.0*tan(teta))/cos(l)-10*eps<<'\n';
        //OK(ok);
    }


    return 0;
}
/*


*/
Copy
I Shot the Sheriff Wise-ard
GNU G++17
1 ms
920 KB
Accepted