QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#552261 | #9253. Prism Palace | ucup-team296# | WA | 61ms | 6316kb | C++14 | 814b | 2024-09-07 21:31:36 | 2024-09-07 21:31:37 |
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;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4224kb
input:
3 0 0 1 0 0 1
output:
1
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4112kb
input:
4 0 0 0 1 1 1 1 0
output:
0
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4192kb
input:
4 0 0 0 3 1 2 1 1
output:
0.5
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 61ms
memory: 6316kb
input:
199996 719157942 80035870 719158808 80033199 719160795 80027070 719162868 80020675 719165635 80012139 719166422 80009711 719166927 80008153 719168388 80003645 719168539 80003179 719168806 80002355 719168864 80002176 719169119 80001389 719171067 79995376 719173806 79986921 719175195 79982633 71917686...
output:
199992.00007771793753
result:
wrong answer 1st numbers differ - expected: '0.0000777', found: '199992.0000777', error = '199992.0000000'