编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#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;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:6 ms
内存:348 KiB

输入文件(1.in

3 35941
583.04714 3121.03022
1806.86186 1416.16563
4984.18545 200.02605

答案文件(1.ans

15854.07033788921762607060

用户输出

15854.070338

Special Judge 信息

OK Error:0.00000011078237349693

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:5 ms
内存:276 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.847945

Special Judge 信息

OK Error:0.00000030051753086013

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:8 ms
内存:400 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.814102

Special Judge 信息

OK Error:0.00000015888117133045

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:5 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.255045

Special Judge 信息

OK Error:0.00000031784099441268

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:7 ms
内存:396 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.228634

Special Judge 信息

OK Error:0.00000024615934535177

系统信息

Exited with return code 0