Untitled
unknown
plain_text
a month ago
1.4 kB
3
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]; double p,s,ans = 0,a,b,c,r; void inp() { cin >> n; For(i,1,n) cin >> x[i] >> y[i]; } void swa(double a, double b, double c) { if (b < c) swap(b,c); if (a < b) swap(a,b); if (a < c) swap(a,c); } double Tinh(int i, int j) { double res = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j])); return res; } double Rad(double a, double b, double c) { p = (a + b + c)/2; s =sqrt(p*(p-a)*(p-b)*(p-c)); double res = (a*b*c)/(4*s); return res; } void solve() { For(i,1,n-2) For(j,i+1,n-1) For(k,j+1,n) { a = Tinh(i,j); b = Tinh(j,k); c = Tinh(i,k); swa(a,b,c); if(a*a>= b*b + c*c) r = a/2; if (a*a < b*b + c*c)r = Rad(a,b,c); ans = max (ans,r); } 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