编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#31898 #1012. L. 注重风控,风火轮模型 Accepted 100 17 ms 356 K C++ 17 / 846 B 2n8asm 2020-07-05 19:01:47
显示原始代码
#ifdef D
#include "hpp.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

using R = long double;

struct P {
    R x;
    R y;
};

vector<P> p;
R d = 0;
int i, n, r;

inline R dist(int x, int y) { return hypotl(p[x].x - p[y].x, p[x].y - p[y].y); }

inline R angl(int x, int y, int z) {
    R const xy = dist(x, y);
    R const xz = dist(x, z);
    R const yz = dist(y, z);
    R const a1 = acosl(xy / r) + acosl(yz / r);
    R const a0 = acosl((xy * xy + yz * yz - xz * xz) / xy / yz / 2);
    return a1 - a0;
}

int main() {
    cin >> n >> r;
    p.resize(n);
    r <<= 1;
    for (P &p : p) {
        cin >> p.x >> p.y;
    }
    for (i = n - 1; i; --i) {
        d += angl(i - 1, i, (i + 1) % n) * dist(i, 0);
    }
    cout << setprecision(numeric_limits<R>::digits10) << d;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:276 KiB

输入文件(1.in

3 35941
583.04714 3121.03022
1806.86186 1416.16563
4984.18545 200.02605

答案文件(1.ans

15854.07033788921762607060

用户输出

15854.0703378892215

Special Judge 信息

OK Error:0.00000000000387423427

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:4 ms
内存:280 KiB

输入文件(2.in

15 21331
504.05781 3250.88951
1718.34697 1497.03649
3702.66308 378.64555
4424.20987 234.65996
4821.3
<235 bytes omitted>

答案文件(2.ans

29335.84794469948246842250

用户输出

29335.8479446995139

Special Judge 信息

OK Error:0.00000000003143085792

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:3 ms
内存:356 KiB

输入文件(3.in

15 35155
1903.22247 1332.58007
2542.13948 884.86186
4344.54468 244.96285
5745.72528 258.28156
7454.5
<234 bytes omitted>

答案文件(3.ans

32799.81410184111882699654

用户输出

32799.8141018411319

Special Judge 信息

OK Error:0.00000000001307398634

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:4 ms
内存:264 KiB

输入文件(4.in

100 21315
202.73110 4838.10150
207.03370 4740.24226
222.70360 4533.69633
233.73077 4431.95278
304.67
<2075 bytes omitted>

答案文件(4.ans

29761.25504531784099526703

用户输出

29761.2550453168384

Special Judge 信息

OK Error:0.00000000100259534008

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:3 ms
内存:352 KiB

输入文件(5.in

100 34201
202.23054 4853.68467
206.74735 4745.58106
289.91929 4075.26238
488.79146 3360.18368
513.94
<2079 bytes omitted>

答案文件(5.ans

32998.22863424615934491158

用户输出

32998.2286342459875

Special Judge 信息

OK Error:0.00000000017184476064

系统信息

Exited with return code 0