半平面交练习(计算几何)

四:半平面交

Rotating Scoreboard

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool cmp_Half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e3 + 10;

Line que[N];

bool Half_lane_intersection(vector<Line> &a) {
    sort(a.begin(), a.end(), cmp_Half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    if (tail - head < 3) return false;
    return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int T;
    scanf("%d", &T);
    while(T--) {
        int n;
        scanf("%d", &n);
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        if(Half_lane_intersection(a)) puts("YES");
        else puts("NO");
    }
	return 0;
}

How I Mathematician Wonder What You Are!

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool cmp_Half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e3 + 10;

Line que[N];

bool Half_lane_intersection(vector<Line> &a) {
    sort(a.begin(), a.end(), cmp_Half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    if (tail - head < 3) return false;
    return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    while(scanf("%d", &n) && n) {
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        if(Half_lane_intersection(a)) puts("1");
        else puts("0");
    }
	return 0;
}

Video Surveillance

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool cmp_Half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e3 + 10;

Line que[N];

bool Half_lane_intersection(vector<Line> &a) {
    sort(a.begin(), a.end(), cmp_Half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    if (tail - head < 3) return false;
    return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, cas = 1;
    while(scanf("%d", &n) && n) {
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        printf("Floor #%d\n", cas++);
        if(!Half_lane_intersection(a)) puts("Surveillance is impossible.");
        else puts("Surveillance is possible.");
        puts("");
    }
	return 0;
}

Art Gallery

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool Cmp_half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e4 + 10;

Line que[N];

double Half_lane_intersection(vector<Line> &a) {
    sort(a.begin(), a.end(), Cmp_half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    n = tail - head;
    if(n < 3) return 0;
    vector<Point> ans;
    for(int i = head; i < tail; i++) {
        ans.push_back(Intersect_point(que[i], que[(i + 1) % n + head]));
    }
    return Area(ans, ans.size());
    // if (tail - head < 3) return false;
    // return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int T, n;
    scanf("%d", &T);
    while(T--) {
        scanf("%d", &n);
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        printf("%.2f\n", Half_lane_intersection(a));
    }
	return 0;
}

Most Distant Point from the Sea

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool Cmp_half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e4 + 10;

Line que[N];

bool Half_lane_intersection(vector<Line> a, double x) {
    sort(a.begin(), a.end(), Cmp_half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n; i++) {
        Vector dir = a[i].ed - a[i].st;
        dir = dir.Rotate(pi / 2);
        double mod = dir.mod();
        dir.x /= mod, dir.y /= mod;
        a[i].st = a[i].st + (dir << x);
        a[i].ed = a[i].ed + (dir << x);
    }
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    // n = tail - head;
    // if(n < 3) return 0;
    // vector<Point> ans;
    // for(int i = head; i < tail; i++) {
    //     ans.push_back(Intersect_point(que[i], que[(i + 1) % n + head]));
    // }
    // return Area(ans, ans.size());
    if (tail - head < 3) return false;
    return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int T, n;
    // scanf("%d", &T);
    while(scanf("%d", &n) && n) {
        // scanf("%d", &n);
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        double l = 0, r = 10000;
        for(int i = 1; i <= 300; i++) {
            double mid = (l + r) / 2;
            if(Half_lane_intersection(a, mid)) l = mid;
            else r = mid;
        }
        printf("%.6f\n", l);
    }
	return 0;
}

Feng Shui (待调)

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

const double pi = acos(-1.0);
const double eps = 1e-5;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    // ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool Cmp_half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 1e4 + 10;

Line que[N];

void Half_lane_intersection(vector<Line> a, double x) {
    sort(a.begin(), a.end(), Cmp_half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n; i++) {
        Vector dir = a[i].ed - a[i].st;
        dir = dir.Rotate(pi / 2);
        double mod = dir.mod();
        dir.x /= mod, dir.y /= mod;
        a[i].st = a[i].st + (dir << x);
        a[i].ed = a[i].ed + (dir << x);
    }
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    n = tail - head;
    // if(n < 3) return 0;
    vector<Point> ans;
    for(int i = head; i < tail; i++) {
        ans.push_back(Intersect_point(que[i], que[(i + 1) % n + head]));
    }
    double dis = -1;
    int fi = 0, se = 0;
    n = ans.size();
    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            double now = Dis_pp(ans[i], ans[j]);
            if(Sgn(now - dis) > 0) {
                fi = i, se = j;
                dis = now;
            }
        }
    }
    if(fabs(ans[fi].x) < eps) ans[fi].x = 0;
    if(fabs(ans[fi].y) < eps) ans[fi].y = 0;
    if(fabs(ans[se].x) < eps) ans[se].x = 0;
    if(fabs(ans[se].y) < eps) ans[se].y = 0;
    printf("%.4f %.4f %.4f %.4f\n", ans[fi].x, ans[fi].y, ans[se].x, ans[se].y);
    // return Area(ans, ans.size());
    // if (tail - head < 3) return false;
    // return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int T, n;
    double r;
    // scanf("%d", &T);
    while(scanf("%d %lf", &n, &r) != EOF) {
        // scanf("%d", &n);
        vector<Point> res;
        for(int i = 0; i < n; i++) {
            Point ans;
            ans.read();
            res.push_back(ans);
        }
        double area = Area(res, n);
        vector<Line> a;
        if(area > 0) {
            for(int i = 0; i < n; i++) {
                a.push_back(Line(res[i], res[(i + 1) % n]));
            }
        }
        else {
            for(int i = n - 1; i >= 0; i--) {
                a.push_back(Line(res[(i + 1) % n], res[i]));
            }
        }
        Half_lane_intersection(a, r);
    }
	return 0;
}

Triathlon

Hotter Colder

Uyuw’s Concert(待修正)

/*
  Author : lifehappy
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

#define double long double

const double pi = acos(-1.0);
const double eps = 1e-10;
const double inf = 1e100;

int Sgn(double x) {
    return x < -eps ? -1 : x > eps;
}

struct Vector {
    double x, y;

    bool operator < (Vector &a) const {
        return x < a.x;
    }

    void print() {
        printf("%f %f\n", x, y);
    }

    void read() {
        scanf("%lf %lf", &x, &y);
    }

    Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

    double mod() {
        return sqrt(x * x + y * y);
    }

    double mod2() {
        return x * x + y * y;
    }

    Vector operator + (const Vector &a) {
        return Vector(x + a.x, y + a.y);
    }

    Vector operator - (const Vector &a) {
        return Vector(x - a.x, y - a.y);
    }

    double operator * (const Vector &a) {
        return x * a.x + y * a.y;
    }

    double operator ^ (const Vector &a) {
        return x * a.y - y * a.x;
    }

    Vector Rotate(double angle) {
        return Vector(x * cos(angle) - y * sin(angle), x * sin(angle) + y * cos(angle));
    }

    Vector operator << (const double &a) {
        return Vector(x * a, y * a);
    }

    Vector operator >> (const double &a) {
        return Vector(x / a, y / a);
    }

    bool operator == (const Vector & a) {
        return (Sgn(x - a.x) == 0) && (Sgn(y - a.y) == 0);
    }
};

typedef Vector Point;

double Dis_pp(Point a, Point b) {
    return sqrt((a - b) * (a - b));
}

double Angle(Vector a, Vector b) {//[0, 2pi)
    double ans = atan2(a ^ b, a * b);
    return ans < 0 ? ans + 2 * pi : ans;
    // return atane(a ^ b, a * b);
}

double To_lefttest(Point a, Point b, Point c) {
    return (b - a) ^(c - a);
}

int Toleft_test(Point a, Point b, Point c) {
    return Sgn((b - a) ^ (c - a));
}

struct Line {
    Point st, ed;

    Line(Point _st = Point(0, 0), Point _ed = Point(0, 0)) : st(_st), ed(_ed) {}

    bool operator < (const Line &t) {
        return st.x < t.st.x;
    }

    void read() {
        scanf("%lf %lf %lf %lf", &st.x, &st.y, &ed.x, &ed.y);
    }
};

bool Parallel(Line a, Line b) {
    return Sgn((a.st - a.ed) ^ (b.st - b.ed)) == 0;
}

bool Is_cross(Line a, Line b) {
    return Toleft_test(a.st, a.ed, b.st) * Toleft_test(a.st, a.ed, b.ed) <= 0 && Toleft_test(b.st, b.ed, a.st) * Toleft_test(b.st, b.ed, a.ed) <= 0;
}

Point Cross_point(Line a, Line b) {
    if(!Is_cross(a, b)) {
        return Point(inf, inf);
    }
    else {
        double a1 = fabs(To_lefttest(a.st, a.ed, b.st)), a2 = fabs(To_lefttest(a.st, a.ed, b.ed));
        return ((b.st << a2) + (b.ed << a1)) >> (a1 + a2);
    }
}

Point Intersect_point(Line a, Line b) {
  double a1 = a.st.y - a.ed.y, b1 = a.ed.x - a.st.x, c1 = a.st.x * a.ed.y - a.ed.x * a.st.y;
  double a2 = b.st.y - b.ed.y, b2 = b.ed.x - b.st.x, c2 = b.st.x * b.ed.y - b.ed.x * b.st.y;
  return Point((c1 * b2 - c2 * b1) / (a2 * b1 - a1 * b2), (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1));
}

Point Shadow(Line a, Point b) {
    Point dir = a.ed - a.st;
    return a.st + (dir << (((b - a.st) * dir) / dir.mod2()));
}

Point Reflect(Line a, Point b) {
    return (Shadow(a, b) << 2) - b;
}

bool inmid(double a, double b, double x) {
    if(a > b) swap(a, b);
    return Sgn(x - a) >= 0 && Sgn(b - x) >= 0;
}

bool Point_in_line(Line a, Point b) {
    if(Toleft_test(a.st, a.ed, b) != 0) return false;
    return inmid(a.st.x, a.ed.x, b.x) && inmid(a.st.y, a.ed.y, b.y);
}

double Dis_lp(Line a, Point b) {
    Point h = Shadow(a, b);
    if(Point_in_line(a, h)) {
        return Dis_pp(h, b);
    }
    return min(Dis_pp(a.st, b), Dis_pp(a.ed, b));
}

// double Dis_ll(Line a, Line b) {
//     if(Is_cross(a, b)) return 0;
//     return min({Dis_lp(a, b.st), Dis_lp(a, b.ed), Dis_lp(b, a.st), Dis_lp(b, a.ed)});
// }

double Area(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += p[i] ^ p[(i + 1) % n];
    }
    return 0.5 * ans;
}

double Len(vector<Point> p, int n) {
    double ans = 0;
    for(int i = 0; i < n; i++) {
        ans += Dis_pp(p[i], p[(i + 1) % n]);
    }
    return ans;
}

bool Is_convex(Point *a, int n) {
    bool flag[3] = {0, 0, 0};
    for(int i = 0; i < n; i++) {
        flag[Sgn(To_lefttest(a[i], a[(i + 1) % n], a[(i + 2) % n])) + 1] = true;
        if(flag[0] && flag[2]) return false;
    }
    return true;
}

Point p0;

bool cmp_graham(Point a, Point b) {
    int flag = Toleft_test(p0, a, b);
    return flag == 0 ? Dis_pp(p0, a) < Dis_pp(p0, b) : flag > 0;
}

vector<Point> Graham(vector<Point> &a, int n) {
    p0 = a[0];
    for(int i = 0; i < n; i++) {
        if(a[i].y < p0.y || (a[i].y == p0.y && a[i].x < p0.x)) {
            p0 = a[i];
        }
    }
    vector<Point> ans;
    sort(a.begin(), a.end(), cmp_graham);
    if(n == 1) {
        ans.push_back(a[0]);
        return ans;
    }
    if(n == 2) {
        ans.push_back(a[0]);
        ans.push_back(a[1]);
        return ans;
    }
    ans.push_back(a[0]);
    ans.push_back(a[1]);
    int sz = 2;
    for(int i = 2; i < n; i++) {
        while(sz > 1 && To_lefttest(ans[sz - 2], ans[sz - 1], a[i]) <= 0) {
            ans.pop_back();
            sz--;
        }
        ans.push_back(a[i]);
        sz++;
    }
    return ans;
}

bool cmp_andrew(Point a, Point b) {
    if(Sgn(a.x - b.x) == 0)    return a.y < b.y;
    return a.x < b.x;
}

vector<Point> Andrew(vector<Point> &a, int n) {
    sort(a.begin(), a.end(), cmp_andrew);
    int p1 = 0, p2;
    vector<Point> ans;
    for(int i = 0; i < n; i++) {
        while(p1 > 1 && Toleft_test(ans[p1 - 2], ans[p1 - 1], a[i]) <= 0)   ans.pop_back(), p1--;
        ans.push_back(a[i]), p1++;
    }
    p2 = p1;
    for(int i = n - 2; i>= 0; i--) {
        while(p2 > p1 && Toleft_test(ans[p2 - 2], ans[p2 - 1], a[i]) <= 0)  ans.pop_back(), p2--;
        ans.push_back(a[i]), p2++;
    }
    ans.pop_back();
    return ans;
}

double Get_angle(Line a) {
  return atan2(a.ed.y - a.st.y, a.ed.x - a.st.x);
}

bool Cmp_half_lane_intersection(Line a, Line b) {
  Vector va = a.ed - a.st, vb = b.ed - b.st;
  double A =  Get_angle(va), B = Get_angle(vb);
  if (Sgn(A - B) == 0) return Sgn(((va) ^ (b.ed - a.st))) != -1;
  return Sgn(A - B) == -1;
}

bool On_right(Line a, Line b, Line c) {
  Point o = Intersect_point(b, c);
  if (Sgn((a.ed - a.st) ^ (o - a.st)) < 0) return true;
  return false;
}

const int N = 2e4 + 10;

Line que[N];

// Line que[2];

double Half_lane_intersection(vector<Line> &a) {
    sort(a.begin(), a.end(), Cmp_half_lane_intersection);
    int head = 0, tail = 0, cnt = 0, n = a.size();
    for(int i = 0; i < n - 1; i++) {
        if(Sgn(Get_angle(a[i]) - Get_angle(a[i + 1])) == 0) continue;
        a[cnt++] = a[i];
    }
    a[cnt++] = a[n - 1];
    for(int i = 0; i < cnt; i++) {
        while(tail - head > 1 && On_right(a[i], que[tail - 1], que[tail - 2])) tail--;
        while(tail - head > 1 && On_right(a[i], que[head], que[head + 1])) head++;
        que[tail++] = a[i];
    }
    while(tail - head > 1 && On_right(que[head], que[tail - 1], que[tail - 2])) tail--;
    while(tail - head > 1 && On_right(que[tail - 1], que[head], que[head + 1])) head++;
    n = tail - head;
    if(n < 3) return 0;
    vector<Point> ans;
    for(int i = head; i < tail; i++) {
        ans.push_back(Intersect_point(que[i], que[(i + 1) % n + head]));
    }
    return Area(ans, ans.size());
    // if (tail - head < 3) return false;
    // return true;
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    while(scanf("%d", &n) != EOF) {
        vector<Line> ans;
        for(int i = 1; i <= n; i++) {
            Line temp;
            temp.read();
            ans.push_back(temp);
        }
        ans.push_back(Line(Point(0, 0), Point(10000, 0)));
        ans.push_back(Line(Point(10000, 0), Point(10000, 10000)));
        ans.push_back(Line(Point(10000, 10000), Point(0, 10000)));
        ans.push_back(Line(Point(0, 1000), Point(0, 0)));
        printf("%.1lf\n", Half_lane_intersection(ans));
    }
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值