Title: Portal
Meaning of the questions: In a circle centered at the origin in, to a point on the circle you, let you pick two points, so that within three points of contact constitute the largest equilateral triangle perimeter.
Ideas:
The maximum circumference of the triangle is an equilateral triangle inscribed: proof
The largest inscribed triangle is equilateral triangle: links
To point would only counter-clockwise 120 degrees and 120 degrees clockwise rotation to get the two points is the answer
#include <bits/stdc++.h> #define LL long long #define mem(i, j) memset(i, j, sizeof(i)) #define rep(i, j, k) for(int i = j; i <= k; i++) #define dep(i, j, k) for(int i = k; i >= j; i--) #define pb push_back #define make make_pair #define INF INT_MAX #define inf LLONG_MAX #define PI acos(-1) #define fir first #define sec second using namespace std; const int N = 15000; const double eps = 1e-8; const double maxL = 10.0; struct Point { double x, y; Point(double x = 0, double y = 0) : x(x), y(y) { } }; int dcmp(double x) { if(fabs(x) < eps) return 0; else return x < 0 ? -1 : 1; } Point operator + (Point A, Point B) { return Point(A.x + B.x, A.y + B.y); } Point operator - (Point A, Point B) { return Point(A.x - B.x, A.y - B.y); } Point operator * (Point A, double p) { return Point(A.x * p, A.y * p); } Point operator / (Point A, double p) { return Point(A.x / p, A.y / p); } double Cross(Point A, Point B) { return A.x * B.y - A.y * B.x; } double Dot(Point A, Point B) { return A.x * B.x + A.y * B.y; } double Length(Point A) { return sqrt(Dot(A, A)); } Point Rotate(Point A, double rad) { /// 向量逆时针旋转 rad (弧度) return Point(A.x*cos(rad) - A.y*sin(rad), A.x*sin(rad) + A.y*cos(rad)); } Point P, ans1, ans2; const double Angle = 2.0 * PI / 3.0; void solve() { scanf("%lf %lf", &P.x, &P.y); ans1 = Rotate(P, Angle); ans2 = Rotate(P, -Angle); if(ans1.y > ans2.y) swap(ans1, ans2); if(ans1.y == ans2.y && ans1.x > ans2.x) swap(ans1, ans2); printf("%.3f %.3f %.3f %.3f\n", ans1.x, ans1.y, ans2.x, ans2.y); return ; } int main() { int _; scanf("%d", &_); while(_--) solve(); return 0; }