已在b站发布视频:BV1an6MBGE42
还有不会的可以私聊up哦
ac代码:
#include <bits/stdc++.h>
using namespace std;
#define sc second
#define fr first
#define int long long
#define itn long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int, int>
#define endl '\n'
#define enld '\n'
#define all(a) a.begin(), a.end()
#define ui unordered_map<int, int>
#define double long double
const int N = 5e5 + 5;
// const int mod = 998244353;
// const int mod = 1e9 + 7;
double n, m, k, x, y, num, op, sum = 0, cnt = 0;
string s;
void _()
{
double r, s, x0, y0, jiao;
double s_mx;
cin >> r >> x >> y >> s >> x0 >> y0;
double h = sqrt((x - x0) * (x - x0) + (y - y0) * (y - y0));
if (h >= r / 2)
{
s_mx = 3 * sqrt(3) / 4 * r * r;
}
else
{
s_mx = (r + h) * sqrt(r * r - h * h);
}
if (s_mx < s)
{
cout << -1;
return;
}
if (y != y0 || x != x0)
jiao = abs(atan(abs(y - y0) / abs(x - x0)));
else
{
cout << x - r << " " << y << " " << x + r << " " << y << " " << x << " " << y0 + r;
return;
}
double xa, xb, xc, ya, yb, yc, tmp;
if (h < r / 2)
{
tmp = sqrt(r * r - h * h);
bool xx = x0 > x;
bool yy = y0 > y;
bool pan = xx ^ yy;
xa = x0 + tmp * sin(jiao);
ya = y0 + pow(-1, pan + 1) * tmp * cos(jiao);
xb = x0 - tmp * sin(jiao);
yb = y0 - pow(-1, pan + 1) * tmp * cos(jiao);
if (y - y0 <= 5e-7)
xx |= 1;
if (x - x0 <= 5e-7)
yy |= 1;
xc = x + pow(-1, xx) * r * cos(jiao);
yc = y + pow(-1, yy) * r * sin(jiao);
cout << fixed << setprecision(9) << xa << " " << ya << " " << xb << " " << yb << " " << xc << " " << yc;
}
else
{
double ax, ay;
tmp = sqrt(3) / 2 * r;
bool xx = x0 > x;
bool yy = y0 > y;
bool pan = xx ^ yy;
if (xx)
ax = x + r * cos(jiao) / 2;
else
ax = x - r * cos(jiao) / 2;
if (yy)
ay = y + r * sin(jiao) / 2;
else
ay = y - r * sin(jiao) / 2;
xa = ax + tmp * sin(jiao);
ya = ay + pow(-1, pan + 1) * tmp * cos(jiao);
xb = ax - tmp * sin(jiao);
yb = ay - pow(-1, pan + 1) * tmp * cos(jiao);
if (y - y0 <= 5e-7)
xx |= 1;
if (x - x0 <= 5e-7)
yy |= 1;
xc = x + pow(-1, xx) * r * cos(jiao);
yc = y + pow(-1, yy) * r * sin(jiao);
cout << fixed << setprecision(9) << xa << " " << ya << " " << xb << " " << yb << " " << xc << " " << yc;
}
// cerr << xa << " " << ya << endl;
// cerr << xb << " " << yb << endl;
// cerr << xc << " " << yc;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int awa = 1;
// cin >> awa;
while (awa--)
{
_();
}
return 0;
}

京公网安备 11010502036488号