QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#834532 | #9253. Prism Palace | mhw | WA | 56ms | 7404kb | C++20 | 2.6kb | 2024-12-27 20:03:24 | 2024-12-27 20:03:24 |
Judging History
answer
/*
__----~~~~~~~~~~~------___
. . ~~//====...... __--~ ~~
-. \_|// |||\\ ~~~~~~::::... /~
___-==_ _-~o~ \/ ||| \\ _/~~-
__---~~~.==~||\=_ -_--~/_-~|- |\\ \\ _/~
_-~~ .=~ | \\-_ '-~7 /- / || \ /
.~ .~ | \\ -_ / /- / || \ /
/ ____ / | \\ ~-_ / /|- _/ .|| \ /
|~~ ~~|--~~~~--_ \ ~==-/ | \~--===~~ .\/
' ~-| /| |-~\~~ __--~~
|-~~-_/ | | ~\_ _-~ /\
/ \ \__ \/~ \__
_--~ _/ | .-~~____--~-/ ~~==.
((->/~ '.|||' -_| ~~-/ , . _||
-_ ~\ ~~---l__i__i__i--~~_/
_-~-__ ~) \--______________--~~
//.-~~~-~_--~- |-------~~~~~~~~
//.-~~~--\
神兽 护卫
ACCEPTED
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define inf 0x3f3f3f3f
#define db double
#define il inline
#define endl '\n'
const int N = 2e5 + 5;
const int mod = 998244353;
const double PI = acos(-1.0); // pai, 3.1415916....
typedef struct Point
{
double x, y;
Point(double x = 0, double y = 0) : x(x), y(y) {}
Point operator-(const Point &B) const { return Point(x - B.x, y - B.y); }
double operator*(const Point &B) const { return x * B.x + y * B.y; }
} Vector;
double len(Vector A) { return sqrt(A * A); }
double Angle(Vector A, Vector B)
{
double t = acos((A * B) / len(A) / len(B));
return t; // 返回 [0, π]
}
Point a[N];
void solve()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y;
a[0] = a[n];
a[n + 1] = a[1];
a[n + 2] = a[2];
double ans = 0.0;
for (int i = 1; i <= n; i++)
{
ans += max(PI - Angle(a[i - 1] - a[i], a[i + 1] - a[i]) - Angle(a[i] - a[i + 1], a[i + 2] - a[i + 1]), 0.0);
}
ans = ans / PI;
cout << fixed << setprecision(10) << ans << '\n';
}
signed main()
{
// freopen("D:\\3022244240\\vscode\\txt\\in.txt", "r", stdin);
// freopen("D:\\3022244240\\vscode\\txt\\out.txt", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int T = 1;
// cin >> T;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 7276kb
input:
3 0 0 1 0 0 1
output:
1.0000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 7176kb
input:
4 0 0 0 1 1 1 1 0
output:
0.0000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 7200kb
input:
4 0 0 0 3 1 2 1 1
output:
0.5000000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 56ms
memory: 7404kb
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:
nan
result:
wrong output format Expected double, but "nan" found