QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#555941 | #9253. Prism Palace | JZYZ | WA | 1ms | 8416kb | C++14 | 1016b | 2024-09-10 12:55:23 | 2024-09-10 12:55:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <typename T>inline void read(T &x)
{
x=0;char c=getchar();bool f=0;
for(;c<'0'||c>'9';c=getchar())f|=(c=='-');
for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+(c-'0');
x=(f?-x:x);
}
const int N = 2e5+7;
int n;
typedef double db;
const db pi =acos(-1);
struct node
{
double x,y;
}p[N],q[N];
node operator -(node a,node b)
{
return (node){a.x-b.x,a.y-b.y};
}
double arc[N];
double ang(node v)
{
return atan2(v.y,v.x);
}
double mod(double t)
{
while(t<0)t+=2.0*pi;
while(t>2.0*pi)t-=2.0*pi;
return t;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
scanf("%lf %lf",&q[i].x,&q[i].y);
}
for(int i=0;i<n;i++)p[i]=q[(i+1)%n]-q[i];
for(int i=0;i<n;i++)
arc[i]=mod(pi+ang(p[(i+1)%n])-ang(p[i]));
db res=0;
for(int i=0;i<n;i++)
{
res+=max(0.0,pi-arc[i]-arc[(i+1)%n]);
}
res/=pi;
printf("%.10lf",res);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 8416kb
input:
3 0 0 1 0 0 1
output:
0.0000000000
result:
wrong answer 1st numbers differ - expected: '1.0000000', found: '0.0000000', error = '1.0000000'