#include #define REP(A,B) for(int (A)=0;(A)<(B);(A)++) #define mp make_pair #define pb push_back #define pii pair #define ll long long #define X first #define Y second using namespace std; vector> V; int crossprod(pii a, pii b, pii c) { return (b.first-a.first)*(c.second-a.second)-(b.second-a.second)*(c.first-a.first); } int main() { int n; while(scanf("%d", &n)==1) { V.clear(); int maxYid=0; REP(i, n) { int a,b; scanf("%d%d", &a, &b); V.pb(mp(a, b)); } sort(V.begin(), V.end(), [](pii a, pii b) { if(a.first!=b.first) return a.firstb.second; }); REP(i, n) if(V[i].second>=V[maxYid].second) { maxYid = i; } vector S; REP(i, n) { if(i < maxYid) continue; if(i>maxYid && V[i].first==V[i-1].first) continue; while(S.size()>=2&&crossprod(V[S[S.size()-2]], V[S[S.size()-1]], V[i])>=0) S.pop_back(); S.push_back(i); } long double best = 1LL<<40; REP(i, S.size()) { if(i) { int i1 = S[i-1], i2 = S[i]; long double K = V[i1].Y-V[i2].Y; K /= V[i1].X-V[i2].X; long double C = V[i1].Y-K*V[i1].X; long double dist = sqrt(C*C+(C/K)*(C/K)); if(dist < best) best = dist; } } REP(i, S.size()) { int i1 = S[i]; long double ALFA = atan(pow(V[i1].Y/(long double)V[i1].X, 1.0/3)); //printf("Alfa=%Lf\n", ALFA); if(i) { int i2 = S[i-1]; long double WTF = abs(atan((V[i2].Y-V[i1].Y)/((long double)V[i2].X-V[i1].X))); //printf("WTF1=%Lf\n", WTF); if(WTF >= ALFA-0.0000001) { continue; } } if(i<((int)S.size()-1)) { int i2 = S[i+1]; long double WTF = abs(atan((V[i1].Y-V[i2].Y)/((long double)V[i2].X-V[i1].X))); //printf("WTF2=%Lf\n", WTF); if(WTF <= ALFA-0.0000001) { continue; } } long double curr = V[i1].X/cos(ALFA)+V[i1].Y/sin(ALFA); // printf("Curr=%Lf\n", curr); if(curr < best) best = curr; } printf("%.3Lf\n", best); } return 0; }