1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
| #include<iostream> #include<cstring> #include<vector> #include<queue> #include<string> #include<algorithm> #include<cmath> #include<cstdio> #include<set> ##define put putchar ##define ls(a) (a << 1) ##define rs(a) (a << 1 | 1) ##define pii pair<int, int>
using namespace std;
const int N = 1e5 + 10; const double eps = 1e-6; const double pi = acos(-1);
int n; double r = 0.0, the, mul;
struct point { double x, y; point (const double& x0 = 0.0, const double& y0 = 0.0) : x(x0), y(y0) { } point operator + (const point& t) const { return point(x + t.x, y + t.y); } point operator - (const point& t) const { return point(x - t.x, y - t.y); } point operator * (const double& t) const { return point(x * t, y * t); } point operator / (const double& t) const { return point(x / t, y / t); } point rotate(double t) { return point(x * cos(t) - y * sin(t), x * sin(t) + y * cos(t)); } point rotate90() { return point(-y, x); } } p[N], o;
double dot(const point& a, const point& b) { return a.x * b.x + a.y * b.y; } double cross(const point& a, const point& b) { return a.x * b.y - a.y * b.x; } double len(const point& a) { return sqrt(dot(a, a)); } double dis(const point &a, const point &b) { return sqrt(dot(a - b, a - b)); }
template<class T> inline void read(T &x) { T res = 0, f = 1; char cc = getchar(); while(! isdigit(cc)) { if(cc == '-') f = -1; cc = getchar(); } while(isdigit(cc)) res = (res << 1) + (res << 3) + cc - 48, cc = getchar(); x = res * f; return ; } template<class T, class ...T1> inline void read(T &x, T1 &...x1) { read(x), read(x1...); return ; } template<class T> inline void write(T x) { if(x < 0) x = -x, put('-'); if(x > 9) write(x / 10); put(x % 10 + 48); return ; } template<> inline void write(char x) { put(x); return ; } template<class T, class ...T1> inline void write(T x, T1 ...x1) { write(x),write(x1...); return ; } template <class T> inline bool chkmax(T &x, T y) { return x < y ? x = y , 1 : 0; }
int sign(double a) { if(fabs(a) < eps) return 0; return a > 0 ? 1 : -1; }
point get_cross(point p0, point v0, point p1, point v1) { double t = cross(p1 - p0, v1) / cross(v0, v1); return p0 + v0 * t; }
point get_circle(point a, point b, point c) { return get_cross((a + b) * 0.5, (b - a).rotate90(), (a + c) * 0.5, (c - a).rotate90()); }
signed main() { read(n); for(int i = 1; i <= n; ++ i) scanf("%lf%lf", &p[i].x, &p[i].y); scanf("%lf%lf", &the, &mul), the = -the / 180.0 * pi, mul = 1.0 / mul; for(int i = 1; i <= n; ++ i) p[i] = p[i].rotate(the), p[i].x *= mul; random_shuffle(p + 1, p + n + 1); for(int i = 1; i <= n; ++ i) if(sign(dis(p[i], o) - r) > 0) { o = p[i], r = 0.0; for(int j = 1; j < i; ++ j) if(sign(dis(p[j], o) - r) > 0) { o = (p[i] + p[j]) * 0.5, r = dis(p[i], p[j]) * 0.5; for(int k = 1; k < j; ++ k) if(sign(dis(p[k], o) - r) > 0) o = get_circle(p[i], p[j], p[k]), r = dis(o, p[i]); } } printf("%.3lf", r); return 0; }
|