Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.5 kB
6
Indexable
Never
#include <bits/stdc++.h>
    #define endl '\n'
    #define maxn 105
    #define TASK bai1
    #define For(i,a,b) for ( int i = a; i <= b; i++ )
    #define MOD 100000000000007

    using namespace std;
    int x[maxn],n,y[maxn];
    void inp()
    {
        cin >> n;
        For(i,1,n)
            cin >> x[i] >> y[i];
    }
    bool check(double a, double b, double c)
    {
        if (a*a >= b*b + c*c) return true;
        if (a*a < b*b + c*c) return false;
    }
    void swa(double &a, double &b, double &c)
    {
        if (a < b) swap(a,b);
        if (a < c) swap(a,c);
    }
    double Rad(int i, int j, int k)
    {
         double a = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
         double b = sqrt((x[j] - x[k])*(x[j] - x[k]) + (y[j] - y[k])*(y[j] - y[k]));
         double c = sqrt((x[i] - x[k])*(x[i] - x[k]) + (y[i] - y[k])*(y[i] - y[k]));
         swa(a,b,c);
         if(a*a>=b*b + c*c) return  a/2;
         else
         {
            double p = (a+b+c)/2;
            double s = sqrt(p*(p-a)*(p-b)*(p-c));
            return (a*b*c)/(4*s);

         }
    }
    void solve()
    {
        double ans = 0;
        For(i,1,n-2)
        For(j,i+1,n-1)
        For(k,j+1,n)
        ans = max(ans,Rad(i,j,k));
        cout << setprecision(3) << fixed << ans;
    }
    int main()
    {
    ios_base:: sync_with_stdio(0);
    cin.tie(0);
    if(fopen("bai1.inp","r")){
        freopen("bai1.inp","r",stdin);
    }
    inp();
    solve();
    }
Leave a Comment