QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#552254 | #9253. Prism Palace | ucup-team296# | WA | 0ms | 4244kb | C++14 | 815b | 2024-09-07 21:29:20 | 2024-09-07 21:29:20 |
Judging History
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'