Untitled
#include <bits/stdc++.h> #define For(i,a,b) for ( int i = a; i <= b; i ++ ) #define maxn 105 #define MOD 10000000000000 using namespace std; int sl; long long tx[maxn], ty[maxn] ; double ma = 0,mi = 0; void inp(){ cin >> sl ; For (i,1,sl) cin >> tx[i] >> ty[i] ; } double R(int a,int b,int c) { double e = sqrt( (tx[a] - tx[b])*(tx[a] - tx[b]) + (ty[a] - ty[b])*(ty[a] - ty[b]) ) ; double f = sqrt( (tx[b] - tx[c])*(tx[b] - tx[c]) + (ty[b] - ty[c])*(ty[b] - ty[c]) ) ; double g = sqrt( (tx[c] - tx[a])*(tx[c] - tx[a]) + (ty[c] - ty[a])*(ty[c] - ty[a]) ) ; if ( e < f ) swap(e,f) ; if ( e < g ) swap(e,g) ; if ( e*e >= f*f + g*g ) { return e/2; } else { double p = ( e + f + g )/2 ; double S = sqrt( p*(p-e)*(p-f)*(p-g) ) ; return ( e*f*g )/( 4*S ) ; } } void solve(){ double ans = 0; For(i,1,sl-2) For(j,i+1,sl-1) For(k,j+1,sl) ans = max(ans,R(i,j,k)) ; cout << fixed << setprecision(3) << ans; } int main (){ ios_base:: sync_with_stdio(0); cin.tie(0); if(fopen("bai1.inp","r")){ freopen("bai1.inp","r",stdin); } inp(); solve(); return 0; }
Leave a Comment