用户输出
-27989.873070009 -18681.348358322
0.000000000
Special Judge 信息
Error(43843.94340789821762527367) too large
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#24085 | #1012. L. 注重风控,风火轮模型 | Wrong Answer | 0 | 19 ms | 356 K | C++ 11 / 2.7 K | nocriz🦆 | 2020-03-20 20:27:12 |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &x, const T &y) {
if (x > y)
x = y;
}
template <typename T>
void chmax(T &x, const T &y) {
if (x < y)
x = y;
}
typedef int64_t s64;
typedef uint64_t u64;
typedef uint32_t u32;
typedef pair<int, int> pii;
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define per(i, r, l) for (int i = r; i >= l; --i)
#define rep0(i, l, r) for (int i = l; i < r; ++i)
#define gc (c = getchar())
int read() {
char c;
while (gc < '-')
;
if (c == '-') {
int x = gc - '0';
while (gc >= '0') x = x * 10 + c - '0';
return -x;
}
int x = c - '0';
while (gc >= '0') x = x * 10 + c - '0';
return x;
}
#undef gc
const int N = 100 + 5;
const double PI = acos(-1);
struct Point {
double x, y;
void print() { printf("%.9f %.9f\n", x, y); }
Point rotate(const double &a) { return { x * cos(a) - y * sin(a), y * cos(a) + x * sin(a) }; }
};
Point operator-(const Point &a, const Point &b) { return { a.x - b.x, a.y - b.y }; }
Point operator+(const Point &a, const Point &b) { return { a.x + b.x, a.y + b.y }; }
Point operator*(const Point &a, const double &k) { return { a.x * k, a.y * k }; }
double operator*(const Point &a, const Point &b) { return a.x * b.y - b.x * a.y; }
double sqr(const double &x) { return x * x; }
double dis(const Point &a, const Point &b) { return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)); }
double dis2(const Point &a, const Point &b) { return sqr(a.x - b.x) + sqr(a.y - b.y); }
Point rotate(const Point &p, const Point &O, const double &a) { return O + (p - O).rotate(a); }
Point p[N];
int n, r;
bool check(const Point &O) {
rep(j, 1, n) if (dis2(p[j], O) > r * r + 1e-9) return 0;
return 1;
}
Point work(int i, int r) {
Point a = p[i], b = p[i + 1];
Point mid = (a + b) * 0.5;
double sqr_len = sqr(r) - (sqr(a.x - mid.x) + sqr(a.y - mid.y));
Point d = b - a;
swap(d.x, d.y);
d.x *= -1;
d = d * sqrt(sqr_len / (sqr(d.x) + sqr(d.y)));
// assert(fabs(sqr(d.x)+sqr(d.y)-sqr_len)<1e-9);
Point c = mid + d;
if (!check(c))
return mid - d;
return c;
}
int main() {
#ifdef kcz
freopen("1.in", "r", stdin); // freopen("1.out","w",stdout);
#endif
cin >> n >> r;
rep(i, 1, n) cin >> p[i].x >> p[i].y;
double ans = 0;
p[n + 1] = p[1];
p[0] = p[n];
Point O = work(1, r);
O.print();
rep(i, 2, n) {
double l = 0, r = PI;
rep(tmp, 1, 100) {
double mid = (l + r) / 2;
if (check(rotate(O, p[i], mid)))
l = mid;
else
r = mid;
}
// printf("%.9f\n",l/2/PI*360);
O = rotate(O, p[i], l);
// printf("%.9f %.9f\n",dis(O,p[i+1]),dis(O,p[i]));
// O.print();
ans += fabs(l) * dis(p[i], p[1]);
// printf("%.9f\n",dis(p[i],p[1]));
}
printf("%.9f\n", ans);
}
用户输出
-27989.873070009 -18681.348358322
0.000000000
Special Judge 信息
Error(43843.94340789821762527367) too large
系统信息
Exited with return code 0
15 21331
504.05781 3250.88951
1718.34697 1497.03649
3702.66308 378.64555
4424.20987 234.65996
4821.3
<235 bytes omitted>
用户输出
18627.056747122 14501.154863541
29677.440305846
Special Judge 信息
Error(10708.79119757748246755114) too large
系统信息
Exited with return code 0
15 35155
1903.22247 1332.58007
2542.13948 884.86186
4344.54468 244.96285
5745.72528 258.28156
7454.5
<234 bytes omitted>
用户输出
22395.909518951 29896.960030254
32868.997477124
Special Judge 信息
Error(10403.90458289011882619945) too large
系统信息
Exited with return code 0
100 21315
202.73110 4838.10150
207.03370 4740.24226
222.70360 4533.69633
233.73077 4431.95278
304.67
<2075 bytes omitted>
用户输出
21499.253806804 5725.426467864
29767.490207286
Special Judge 信息
Error(8262.00123851384099538109) too large
系统信息
Exited with return code 0
100 34201
202.23054 4853.68467
206.74735 4745.58106
289.91929 4075.26238
488.79146 3360.18368
513.94
<2079 bytes omitted>
用户输出
34375.631945785 6227.379453827
33009.267625894
Special Judge 信息
Error(1377.40331153884065429338) too large
系统信息
Exited with return code 0