#include #include #include #include using namespace std; typedef pair P; int cross(P u, P v) { return u.first * v.second - u.second * v.first; } int cross(pair a, pair b, pair c) { P u = make_pair(b.first - a.first, b.second - a.second); P v = make_pair(c.first - b.first, c.second - b.second); return u.first * v.second - u.second * v.first; } void doCase(int n) { vector > points; points.reserve(n); for(int i = 0;i < n; i++) { int x, y; cin >> x >> y; points.push_back(make_pair(x, y)); } sort(points.begin(), points.end()); vector > result; for(auto& p : points) { result.push_back(p); while(result.size() >= 3 && cross(result[result.size() - 3], result[result.size() - 2], result[result.size() - 1]) > 0) { result[result.size() - 2] = result[result.size() - 1]; result.pop_back(); } while(result.size() >= 2 && result[result.size() - 1].second >= result[result.size() - 2].second) { result[result.size() - 2] = result[result.size() - 1]; result.pop_back(); } } vector

aresult; aresult.push_back(make_pair(0, result[0].second)); for(auto& p : result) aresult.push_back(p); aresult.push_back(make_pair(result.back().first, 0)); double best = 10e8; /* for(auto& p : aresult) cerr << "x " << p.first << " " << p.second << endl; */ for(int i = 1; i < aresult.size() - 1; i++) { auto& p = aresult[i]; auto& prev = aresult[i - 1]; auto& next = aresult[i + 1]; //cerr << p.first << " " << p.second << endl; double alpha = atan(pow(p.first / p.second, 1/3.0)); double beta = atan((double) (next.first - p.first) / (p.second - next.second)); double gamma = 10e9; if(p.second != prev.second) gamma = atan((double) (p.first - prev.first) / (prev.second - p.second)); //cerr << "! " << alpha << " " << beta << " " << gamma << endl; alpha = min(alpha, gamma); alpha = max(alpha, beta); //cerr << alpha << endl; double length = p.second / cos(alpha) + p.first / sin(alpha); double lengthB = p.second / cos(beta) + p.first / sin(beta); double lengthG = p.second / cos(gamma) + p.first / sin(gamma); if(gamma > 10e8) lengthG = 10e8; if(beta < 10e-8) lengthB = 10e8; //cerr << " " << length << " " << lengthB << " " << lengthG << endl; best = min(best, min(lengthB, min(lengthG, length))); } cout.precision(9); cout << best << endl; } int main() { int n; cin >> n; while(!cin.fail()) { doCase(n); cin >> n; } }