QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#552254#9253. Prism Palaceucup-team296#WA 0ms4244kbC++14815b2024-09-07 21:29:202024-09-07 21:29:20

Judging History

你现在查看的是最新测评结果

  • [2024-09-07 21:29:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4244kb
  • [2024-09-07 21:29:20]
  • 提交

answer

#include <bits/stdc++.h>

#define long long long int
#define DEBUG
using namespace std;

// @author: pashka

double ang(pair<double, double> a, pair<double, double> b) {
    double dx = b.first - a.first;
    double dy = b.second - a.second;
    return -atan2(dy, dx);
}

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<pair<double, double>> p(n);
    for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
    double res = 0;
    for (int i = 0; i < n; i++) {
        double a1 = ang(p[i], p[(i + 1) % n]);
        double a2 = ang(p[(i + 2) % n], p[(i + 3) % n]);
        if (a2 < a1) a2 += M_PI * 2;
        double da = a2 - a1;
        res += max(da - M_PI, 0.0);
    }
    cout << setprecision(20) << res / M_PI << "\n";

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4244kb

input:

3
0 0
1 0
0 1

output:

0

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '0.0000000', error = '1.0000000'