用户输出
15854.070338
Special Judge 信息
OK Error:0.00000011078237349693
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#15774 | #1012. L. 注重风控,风火轮模型 | Accepted | 100 | 31 ms | 400 K | C++ 11 / 1.2 K | wujunnan | 2019-07-09 21:42:17 |
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
struct point {
long double x, y;
};
long double dis(point a, point b) {
long double s;
s = pow((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y), 0.5);
return s;
}
long double jiaodu(long double l1, long double l2, long double l3) {
long double seta;
seta = acos((l1 * l1 + l2 * l2 - l3 * l3) / (2 * l1 * l2));
return seta;
}
long double R;
long double operation(point a, point b, point c, point zero) {
long double r = dis(b, zero);
long double l1 = dis(a, b);
long double l2 = dis(b, c);
long double l3 = dis(a, c);
long double seta1, seta2, seta3;
seta1 = jiaodu(l1, l2, l3);
seta2 = jiaodu(l1, R, R);
seta3 = jiaodu(l2, R, R);
return r * (seta2 + seta3 - seta1);
}
int main() {
int n;
cin >> n >> R;
vector<point> v;
point temp;
for (int i = 0; i < n; i++) {
cin >> temp.x >> temp.y;
v.push_back(temp);
}
v.push_back(v[0]);
v.push_back(v[1]);
long double sum = 0;
for (int i = 0; i < n - 1; i++) {
point a, b, c;
a = v[i];
b = v[i + 1];
c = v[i + 2];
sum += operation(a, b, c, v[0]);
}
printf("%Lf", sum);
return 0;
}
用户输出
15854.070338
Special Judge 信息
OK Error:0.00000011078237349693
系统信息
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>
用户输出
29335.847945
Special Judge 信息
OK Error:0.00000030051753086013
系统信息
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>
用户输出
32799.814102
Special Judge 信息
OK Error:0.00000015888117133045
系统信息
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>
用户输出
29761.255045
Special Judge 信息
OK Error:0.00000031784099441268
系统信息
Exited with return code 0